Commit e795c6ed authored by Kirill Smelkov's avatar Kirill Smelkov

X neotest: Fix disk display in case of DM

Similarly to 352cd100 (X neotest: Fix disk display in case of MD).

before:

    # vg0-root:   rev     74.5G

after:

    # dm-0 (vg0-root) -> sdi2
    # sdi: PERC H330 Mini    rev 4.27 111.3G
parent 56faccad
...@@ -572,6 +572,7 @@ system_info() { ...@@ -572,6 +572,7 @@ system_info() {
# disk under . # disk under .
mntpt=`stat -c '%m' .` # mountpoint of current filesystem mntpt=`stat -c '%m' .` # mountpoint of current filesystem
blkdev=`findmnt -n -o source $mntpt` # mountpoint -> device blkdev=`findmnt -n -o source $mntpt` # mountpoint -> device
blkdev=`realpath $blkdev` # /dev/mapper/vg0-root -> /dev/dm-0
blkdev1=`basename $blkdev` # /dev/sda -> sda blkdev1=`basename $blkdev` # /dev/sda -> sda
# showblk1 <device> # showblk1 <device>
...@@ -587,6 +588,17 @@ system_info() { ...@@ -587,6 +588,17 @@ system_info() {
# software raid # software raid
slavev=`ls -x /sys/class/block/$blkdev1/slaves` slavev=`ls -x /sys/class/block/$blkdev1/slaves`
echo "# $blkdev1 (`cat /sys/class/block/$blkdev1/md/level`) -> $slavev" echo "# $blkdev1 (`cat /sys/class/block/$blkdev1/md/level`) -> $slavev"
# XXX dup wrt dm-*; move recursion to common place
for s in $slavev; do
s=`echo $s |sed -e 's/[0-9]*$//'` # sda3 -> sda
showblk1 /dev/$s
done
;;
dm-*)
# device mapper
slavev=`ls -x /sys/class/block/$blkdev1/slaves`
echo "# $blkdev1 (`cat /sys/class/block/$blkdev1/dm/name`) -> $slavev"
# XXX dup wrt md*; move recursion to common place
for s in $slavev; do for s in $slavev; do
s=`echo $s |sed -e 's/[0-9]*$//'` # sda3 -> sda s=`echo $s |sed -e 's/[0-9]*$//'` # sda3 -> sda
showblk1 /dev/$s showblk1 /dev/$s
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment