@@ -25,7 +25,8 @@
exit 1
fi
-i=`/sbin/dmsetup ls --target linear --exec basename -j $1 -m $2 2> /dev/null`
+dev=`/sbin/dmsetup ls --target linear -j $1 -m $2 | sed -e 's/([ 0-9]*,[ 0-9]*)//g' 2>/dev/null`
+i=`basename $dev 2>/dev/null`
if [ -n "$i" ] ; then
echo $i
@@ -19,7 +19,8 @@
exit 1
fi
-i=`/sbin/dmsetup ls --target multipath --exec basename -j $1 -m $2 2> /dev/null`
+dev=`/sbin/dmsetup ls --target multipath -j $1 -m $2 | sed -e 's/([ 0-9]*,[ 0-9]*)//g' 2>/dev/null`
+i=`basename $dev 2>/dev/null`
if [ -n "$i" ] ; then
echo $i
@@ -29,5 +29,8 @@
if [ "${DEVPATH:7:3}" = "dm-" -a "${ACTION}" = "add" ]; then
majmin=`awk -F ':' '{ print "-j",$1,"-m",$2 }' /sys/${DEVPATH}/dev`
- /sbin/dmsetup ls ${majmin} --target multipath --exec "/sbin/kpartx -a"
+ devnames=`/sbin/dmsetup ls ${majmin} --target multipath | sed -e 's/([ 0-9]*,[ 0-9]*)//g'`
+ for dev in $devnames; do
+ [ -n "$dev" ] && /sbin/kpartx -a /dev/mapper/$dev
+ done
fi