Closed gdevenyi closed 3 years ago
Seems I'm running the test-version of vdev_id wrong, so here's the right way for the same devices:
# sh -x /lib/udev/vdev_id -d dm-0
+ PATH=/bin:/sbin:/usr/bin:/usr/sbin
+ CONFIG=/etc/zfs/vdev_id.conf
+ PHYS_PER_PORT=
+ DEV=
+ MULTIPATH=
+ TOPOLOGY=
+ BAY=
+ getopts c:d:eg:mp:h OPTION
+ DEV=dm-0
+ getopts c:d:eg:mp:h OPTION
+ [ ! -r /etc/zfs/vdev_id.conf ]
+ [ -z dm-0 -a -z ]
+ [ -z ]
+ awk $1 == "topology" {print $2; exit} /etc/zfs/vdev_id.conf
+ TOPOLOGY=
+ [ -z ]
+ awk $1 == "slot" {print $2; exit} /etc/zfs/vdev_id.conf
+ BAY=
+ TOPOLOGY=sas_direct
+ [ = yes -a sas_direct = sas_direct ]
+ alias_handler
+ local DM_PART=
+ echo
+ grep -q -E p[0-9][0-9]*$
+ ID_VDEV=
+ [ -z ]
+ BAY=bay
+ sas_handler
+ [ -z ]
+ awk $1 == "phys_per_port" {print $2; exit} /etc/zfs/vdev_id.conf
+ PHYS_PER_PORT=
+ PHYS_PER_PORT=4
+ echo 4
+ grep -q -E ^[0-9]+$
+ [ -z ]
+ awk $1 == "multipath" {print $2; exit} /etc/zfs/vdev_id.conf
+ MULTIPATH_MODE=yes
+ [ yes = yes ]
+ [ -z ]
+ ls -l --full-time /dev/mapper
+ awk /\/dm-0$/{print $9}
+ DM_NAME=35000cca26f7c3ca0
+ [ != partition ]
+ echo 35000cca26f7c3ca0
+ awk -Fp /p/{print "-part"$2}
+ PART=
+ echo 35000cca26f7c3ca0
+ sed s/p[0-9][0-9]*$//
+ DM_NAME=35000cca26f7c3ca0
+ [ -z 35000cca26f7c3ca0 ]
+ multipath -ll 35000cca26f7c3ca0
+ awk /running/{gsub("^[|]"," "); print $3 ; exit}
+ DEV=sdc
+ [ -z sdc ]
+ echo sdc
+ grep -q ^/devices/
+ udevadm info -q path -p /sys/block/sdc
+ sys_path=/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:0/end_device-0:0:0/target0:0:0/0:0:0:0/block/sdc
+ echo /devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:0/end_device-0:0:0/target0:0:0/0:0:0:0/block/sdc
+ tr /
+ set -- devices pci0000:5d 0000:5d:00.0 0000:5e:00.0 host0 port-0:0 expander-0:0 port-0:0:0 end_device-0:0:0 target0:0:0 0:0:0:0 block sdc
+ num_dirs=13
+ scsi_host_dir=/sys
+ i=1
+ [ 1 -le 13 ]
+ eval echo ${1}
+ echo devices
+ d=devices
+ scsi_host_dir=/sys/devices
+ echo devices
+ grep -q -E ^host[0-9]+$
+ i=2
+ [ 2 -le 13 ]
+ eval echo ${2}
+ echo pci0000:5d
+ d=pci0000:5d
+ scsi_host_dir=/sys/devices/pci0000:5d
+ echo pci0000:5d
+ grep -q -E ^host[0-9]+$
+ i=3
+ [ 3 -le 13 ]
+ eval echo ${3}
+ echo 0000:5d:00.0
+ d=0000:5d:00.0
+ scsi_host_dir=/sys/devices/pci0000:5d/0000:5d:00.0
+ echo 0000:5d:00.0
+ grep -q -E ^host[0-9]+$
+ i=4
+ [ 4 -le 13 ]
+ eval echo ${4}
+ echo 0000:5e:00.0
+ d=0000:5e:00.0
+ scsi_host_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0
+ echo 0000:5e:00.0
+ grep -q -E ^host[0-9]+$
+ i=5
+ [ 5 -le 13 ]
+ eval echo ${5}
+ echo host0
+ d=host0
+ scsi_host_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0
+ echo host0
+ grep -q -E ^host[0-9]+$
+ break
+ [ 5 = 13 ]
+ eval echo ${4}
+ echo 0000:5e:00.0
+ awk -F: {print $2":"$3}
+ PCI_ID=5e:00.0
+ port_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0
+ j=6
+ i=6
+ [ 6 -le 6 ]
+ eval echo ${6}
+ echo port-0:0
+ port_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0
+ i=7
+ [ 7 -le 6 ]
+ + + head -1
lsawk -d -F: /sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/phy-0:0 {print $NF} /sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/phy-0:1
/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/phy-0:2 /sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/phy-0:3
+ PHY=0
+ [ -z 0 ]
+ PORT=0
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0
+ [ 7 -lt 13 ]
+ eval echo ${7}
+ echo expander-0:0
+ d=expander-0:0
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0
+ echo expander-0:0
+ grep -q ^end_device
+ i=8
+ [ 8 -lt 13 ]
+ eval echo ${8}
+ echo port-0:0:0
+ d=port-0:0:0
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:0
+ echo port-0:0:0
+ grep -q ^end_device
+ i=9
+ [ 9 -lt 13 ]
+ eval echo ${9}
+ echo end_device-0:0:0
+ d=end_device-0:0:0
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:0/end_device-0:0:0
+ echo end_device-0:0:0
+ grep -q ^end_device
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:0/end_device-0:0:0/sas_device/end_device-0:0:0
+ break
+ SLOT=
+ cat /sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:0/end_device-0:0:0/sas_device/end_device-0:0:0/bay_identifier
+ SLOT=0
+ [ -z 0 ]
+ map_channel 5e:00.0 0
+ local MAPPED_CHAN=
+ local PCI_ID=5e:00.0
+ local PORT=0
+ awk $1 == "channel" && $2 == "5e:00.0" && $3 == 0 { print $4; exit } /etc/zfs/vdev_id.conf
+ MAPPED_CHAN=B
+ printf %s B
+ CHAN=B
+ map_slot 0 B
+ local LINUX_SLOT=0
+ local CHANNEL=B
+ local MAPPED_SLOT=
+ awk $1 == "slot" && $2 == 0 && $4 ~ /^B$|^$/ { print $3; exit } /etc/zfs/vdev_id.conf
+ MAPPED_SLOT=
+ [ -z ]
+ MAPPED_SLOT=0
+ printf %d 0
+ SLOT=0
+ [ -z B ]
+ echo B0
+ ID_VDEV=B0
+ [ -n B0 ]
+ echo ID_VDEV=B0
ID_VDEV=B0
+ echo ID_VDEV_PATH=disk/by-vdev/B0
ID_VDEV_PATH=disk/by-vdev/B0
# sh -x /lib/udev/vdev_id -d dm-4
+ PATH=/bin:/sbin:/usr/bin:/usr/sbin
+ CONFIG=/etc/zfs/vdev_id.conf
+ PHYS_PER_PORT=
+ DEV=
+ MULTIPATH=
+ TOPOLOGY=
+ BAY=
+ getopts c:d:eg:mp:h OPTION
+ DEV=dm-4
+ getopts c:d:eg:mp:h OPTION
+ [ ! -r /etc/zfs/vdev_id.conf ]
+ [ -z dm-4 -a -z ]
+ [ -z ]
+ awk $1 == "topology" {print $2; exit} /etc/zfs/vdev_id.conf
+ TOPOLOGY=
+ [ -z ]
+ awk $1 == "slot" {print $2; exit} /etc/zfs/vdev_id.conf
+ BAY=
+ TOPOLOGY=sas_direct
+ [ = yes -a sas_direct = sas_direct ]
+ alias_handler
+ local DM_PART=
+ echo
+ grep -q -E p[0-9][0-9]*$
+ ID_VDEV=
+ [ -z ]
+ BAY=bay
+ sas_handler
+ [ -z ]
+ awk $1 == "phys_per_port" {print $2; exit} /etc/zfs/vdev_id.conf
+ PHYS_PER_PORT=
+ PHYS_PER_PORT=4
+ echo 4
+ grep -q -E ^[0-9]+$
+ [ -z ]
+ awk $1 == "multipath" {print $2; exit} /etc/zfs/vdev_id.conf
+ MULTIPATH_MODE=yes
+ [ yes = yes ]
+ [ -z ]
+ ls -l --full-time /dev/mapper
+ awk /\/dm-4$/{print $9}
+ DM_NAME=35000cca26f81db84
+ [ != partition ]
+ echo 35000cca26f81db84
+ awk -Fp /p/{print "-part"$2}
+ PART=
+ echo 35000cca26f81db84
+ sed s/p[0-9][0-9]*$//
+ DM_NAME=35000cca26f81db84
+ [ -z 35000cca26f81db84 ]
+ multipath -ll 35000cca26f81db84
+ awk /running/{gsub("^[|]"," "); print $3 ; exit}
+ DEV=sdo
+ [ -z sdo ]
+ echo sdo
+ grep -q ^/devices/
+ udevadm info -q path -p /sys/block/sdo
+ sys_path=/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:13/expander-0:1/port-0:1:0/end_device-0:1:0/target0:0:13/0:0:13:0/block/sdo
+ echo /devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:13/expander-0:1/port-0:1:0/end_device-0:1:0/target0:0:13/0:0:13:0/block/sdo
+ tr /
+ set -- devices pci0000:5d 0000:5d:00.0 0000:5e:00.0 host0 port-0:0 expander-0:0 port-0:0:13 expander-0:1 port-0:1:0 end_device-0:1:0 target0:0:13 0:0:13:0 block sdo
+ num_dirs=15
+ scsi_host_dir=/sys
+ i=1
+ [ 1 -le 15 ]
+ eval echo ${1}
+ echo devices
+ d=devices
+ scsi_host_dir=/sys/devices
+ echo devices
+ grep -q -E ^host[0-9]+$
+ i=2
+ [ 2 -le 15 ]
+ eval echo ${2}
+ echo pci0000:5d
+ d=pci0000:5d
+ scsi_host_dir=/sys/devices/pci0000:5d
+ echo pci0000:5d
+ grep -q -E ^host[0-9]+$
+ i=3
+ [ 3 -le 15 ]
+ eval echo ${3}
+ echo 0000:5d:00.0
+ d=0000:5d:00.0
+ scsi_host_dir=/sys/devices/pci0000:5d/0000:5d:00.0
+ echo 0000:5d:00.0
+ grep -q -E ^host[0-9]+$
+ i=4
+ [ 4 -le 15 ]
+ eval echo ${4}
+ echo 0000:5e:00.0
+ d=0000:5e:00.0
+ scsi_host_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0
+ echo 0000:5e:00.0
+ grep -q -E ^host[0-9]+$
+ i=5
+ [ 5 -le 15 ]
+ eval echo ${5}
+ echo host0
+ d=host0
+ scsi_host_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0
+ echo host0
+ grep -q -E ^host[0-9]+$
+ break
+ [ 5 = 15 ]
+ eval echo ${4}
+ echo 0000:5e:00.0
+ awk -F: {print $2":"$3}
+ PCI_ID=5e:00.0
+ port_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0
+ j=6
+ i=6
+ [ 6 -le 6 ]
+ eval echo ${6}
+ echo port-0:0
+ port_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0
+ i=7
+ [ 7 -le 6 ]
+ ls -d /sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/phy-0:0 /sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/phy-0:1 /sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/phy-0:2 /sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/phy-0:3
+ head -1
+ awk -F: {print $NF}
+ PHY=0
+ [ -z 0 ]
+ PORT=0
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0
+ [ 7 -lt 15 ]
+ eval echo ${7}
+ echo expander-0:0
+ d=expander-0:0
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0
+ echo expander-0:0
+ grep -q ^end_device
+ i=8
+ [ 8 -lt 15 ]
+ eval echo ${8}
+ echo port-0:0:13
+ d=port-0:0:13
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:13
+ echo port-0:0:13
+ grep -q ^end_device
+ i=9
+ [ 9 -lt 15 ]
+ eval echo ${9}
+ echo expander-0:1
+ d=expander-0:1
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:13/expander-0:1
+ echo expander-0:1
+ grep -q ^end_device
+ i=10
+ [ 10 -lt 15 ]
+ eval echo ${10}
+ echo port-0:1:0
+ d=port-0:1:0
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:13/expander-0:1/port-0:1:0
+ echo port-0:1:0
+ grep -q ^end_device
+ i=11
+ [ 11 -lt 15 ]
+ eval echo ${11}
+ echo end_device-0:1:0
+ d=end_device-0:1:0
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:13/expander-0:1/port-0:1:0/end_device-0:1:0
+ echo end_device-0:1:0
+ grep -q ^end_device
+ end_device_dir=/sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:13/expander-0:1/port-0:1:0/end_device-0:1:0/sas_device/end_device-0:1:0
+ break
+ SLOT=
+ cat /sys/devices/pci0000:5d/0000:5d:00.0/0000:5e:00.0/host0/port-0:0/expander-0:0/port-0:0:13/expander-0:1/port-0:1:0/end_device-0:1:0/sas_device/end_device-0:1:0/bay_identifier
+ SLOT=0
+ [ -z 0 ]
+ map_channel 5e:00.0 0
+ local MAPPED_CHAN=
+ local PCI_ID=5e:00.0
+ local PORT=0
+ awk $1 == "channel" && $2 == "5e:00.0" && $3 == 0 { print $4; exit } /etc/zfs/vdev_id.conf
+ MAPPED_CHAN=B
+ printf %s B
+ CHAN=B
+ map_slot 0 B
+ local LINUX_SLOT=0
+ local CHANNEL=B
+ local MAPPED_SLOT=
+ awk $1 == "slot" && $2 == 0 && $4 ~ /^B$|^$/ { print $3; exit } /etc/zfs/vdev_id.conf
+ MAPPED_SLOT=
+ [ -z ]
+ MAPPED_SLOT=0
+ printf %d 0
+ SLOT=0
+ [ -z B ]
+ echo B0
+ ID_VDEV=B0
+ [ -n B0 ]
+ echo ID_VDEV=B0
ID_VDEV=B0
+ echo ID_VDEV_PATH=disk/by-vdev/B0
ID_VDEV_PATH=disk/by-vdev/B0
It looks like something about the ID stuff is breaking down and the symlinks are clobbering each other. I will investigate the identifier config.
Changing the slot
to any of the other options doesn't change the returned vdev name.
Adding slot id
to the configuration was able to properly find 90 unique slot identifiers, although with a missing slot 12.
System information
Describe the problem you're observing
I have a system with 2x LSI SAS3008 PCI-Express Fusion-MPT SAS-3 connecting to two IO controllers on a Supermicro 90-disk JBOD: https://www.supermicro.com/en/products/chassis/4U/946/SC946ED-R2KJBOD in a crossover dual-channel config
This is intended to provide cross-failover protection in case of card or IO controller failure. I currently have this configured with "multibus" in multipathd, and it is properly detecting and setting up 90 aggregated paths:
Snip of multipath -ll, some addresses greeked
When attempting to use
vdev_id.conf
using a standard multipath config:I get the following
/dev/disk/by-vdev
entries:Note that this is missing many entries, currently totaling only 40.
When testing vdev_id for bugs, it does appear to throw an error:
It returns the same error for mapper entries that do not get vdevs generated:
I'm unclear from the documentation what a number of the terms are for the vdev_id.conf file in the context of real-world hardware configurations (how do I determine number of phys, how do I know if switch or direct, is a HBA port the actual physical wire, what does "CHANNEL NAME" refer to?), so I'm having much difficulty guessing as to what settings might need to be changed.
Finally, I offer the output of sas_discover from https://github.com/stanford-rc/sasutils which appears to have mapped the entire SAS topology, it does look a bit odd compared to what I expect to see, this may be be due to the internal wiring of the JBOD
It looks like internally the IO controllers each have 1 expander going to 12 disks, and cascading 2 more expanders with 39 disks each, a very odd config, but each of the 90 disks is exposed properly on each physical wiring path, as expected.