Fix inconsistent mount options for ZFS root
[zfs.git] / cmd / zpool / zpool.d / dm-deps
blob44224787f09677704bd93c3ce4edf9507d61af86
1 #!/bin/sh
3 # Show device mapper dependent / underlying devices. This is useful for
4 # looking up the /dev/sd* devices associated with a dm or multipath device.
7 if [ "$1" = "-h" ] ; then
8 echo "Show device mapper dependent (underlying) devices."
9 exit
12 # shellcheck disable=SC2154
13 dev="$VDEV_PATH"
15 # If the VDEV path is a symlink, resolve it to a real device
16 if [ -L "$dev" ] ; then
17 dev=$(readlink "$dev")
20 dev="${dev##*/}"
21 val=""
22 if [ -d "/sys/class/block/$dev/slaves" ] ; then
23 # ls -C: output in columns, no newlines, two spaces (change to one)
24 # shellcheck disable=SC2012
25 val=$(ls -C "/sys/class/block/$dev/slaves" | tr -s '[:space:]' ' ')
28 echo "dm-deps=$val"