Recently retired some SUN fire X4540 nodes. They are very good machines, so get chance to have them reinsalled to Linux, also installed ZOL ZFS 0.6.3.

Got used to see disk name on them as cxty, so tried to use ZOL vdev configuration, but it turns out that ZOL vdev is good for external sas connection, either sas-direct or sas switch, but not for SUN fire X4540 which sas controllers internally connected within the box.

Linux provides by-path(/dev/disk/by-path) naming, it clearly shows the pci path of each disk, but not enough because you still don't know the disk location.

Here is the link talked about mentioned 3 different dev name conventions,  What Dev Names Should I Use When Creating My Pool

Here is what I did to make disk name look like Solaris disk naming.

Step1:  Create a udev script

Here is the script look like, only 4 lines

# cat /etc/udev/scripting/sun_fire_x4540_vdev
ID_VDEV=`/sbin/udevadm info --query=path --name /dev/$1 |awk -F'/' '{print $6$7}' | sed -e 's/host/c/g' |sed -e 's/port-.:/t/g'`
echo "ID_VDEV_PATH=disk/by-vdev/${ID_VDEV}"

Step2: Create a udev rule

# cat /etc/udev/rules.d/90-vdev.rules 
# /etc/udev/rules.d/90-vdev.rules

ENV{DEVTYPE}=="disk", IMPORT{program}="/etc/udev/scripting/sun_fire_x4540_vdev %k"

KERNEL=="*[!0-9]", ENV{SUBSYSTEM}=="block", ENV{ID_VDEV}=="?*", SYMLINK+="$env{ID_VDEV_PATH}"
KERNEL=="*[0-9]", ENV{SUBSYSTEM}=="block", ENV{DEVTYPE}=="partition", ENV{ID_VDEV}=="?*", SYMLINK+="$env{ID_VDEV_PATH}-part%n"
KERNEL=="dm-[0-9]*", ENV{SUBSYSTEM}=="block", ENV{ID_VDEV}=="?*", SYMLINK+="$env{ID_VDEV_PATH}"

Step3: Test

# ls /dev/disk/by-vdev/
c0t0        c0t6-part9    c1t5-part1  c2t4-part9    c3t4        c4t3-part1    c5t2-part9
c0t0-part1  c0t7    c1t5-part9  c2t5    c3t4-part1  c4t3-part9    c5t3
c0t0-part2  c0t7-part1    c1t6        c2t5-part1    c3t4-part9  c4t4    c5t3-part1
c0t0-part3  c0t7-part9    c1t6-part1  c2t5-part9    c3t5        c4t4-part1    c5t3-part9
c0t0-part4  c1t0    c1t6-part9  c2t6    c3t5-part1  c4t4-part9    c5t4
c0t1        c1t0-part1    c1t7        c2t6-part1    c3t5-part9  c4t5    c5t4-part1
c0t1-part1  c1t0-part2    c1t7-part1  c2t6-part9    c3t6        c4t5-part1    c5t4-part9
c0t1-part9  c1t0-part3    c1t7-part9  c2t7    c3t6-part1  c4t5-part9    c5t5
c0t2        c1t0-part4    c2t0        c2t7-part1    c3t6-part9  c4t6    c5t5-part1
c0t2-part1  c1t1    c2t0-part1  c2t7-part9    c3t7        c4t6-part1    c5t5-part9
c0t2-part9  c1t1-part1    c2t0-part9  c3t0    c3t7-part1  c4t6-part9    c5t6
c0t3        c1t1-part9    c2t1        c3t0-part1    c3t7-part9  c4t7    c5t6-part1
c0t3-part1  c1t2    c2t1-part1  c3t0-part9    c4t0        c4t7-part1    c5t6-part9
c0t3-part9  c1t2-part1    c2t1-part9  c3t1    c4t0-part1  c4t7-part9    c5t7
c0t4        c1t2-part9    c2t2        c3t1-part1    c4t0-part9  c5t0    c5t7-part1
c0t4-part1  c1t3    c2t2-part1  c3t1-part9    c4t1        c5t0-part1    c5t7-part9
c0t4-part9  c1t3-part1    c2t2-part9  c3t2    c4t1-part1  c5t0-part9    d1
c0t5        c1t3-part9    c2t3        c3t2-part1    c4t1-part9  c5t1
c0t5-part1  c1t4    c2t3-part1  c3t2-part9    c4t2        c5t1-part1
c0t5-part9  c1t4-part1    c2t3-part9  c3t3    c4t2-part1  c5t1-part9
c0t6        c1t4-part9    c2t4        c3t3-part1    c4t2-part9  c5t2
c0t6-part1  c1t5    c2t4-part1  c3t3-part9    c4t3        c5t2-part1


Note: c0t0 and c1t0 are being used for system disks, while others have Solaris ZFS partitions.

Now, you can safely create zfs pools, probably you know CxTy name convention

Cx: controller #
Ty: target disk #

You can easily find this naming mapping to physical disk from the Vendor's document, so easier to maintenance.

You can also find the mapping from zfs-configuration-and-tuning-example-on-sun-fire-x4540

Overall, if you have other similar product, then you can just simply adjust(maybe not) my script to rename the vdisk to map to your vendor's disk logical --> physical mapping.


Comments powered by CComment