From: Peter Rajnoha Date: Fri, 18 Mar 2016 14:55:36 +0000 (+0100) Subject: fsadm: use stat to get major:minor pair for non-standard /dev layouts X-Git-Tag: v2_02_147~1 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=6c10d1f3d95dc0f7ac55fe55be0115a9fc438da5;p=lvm2.git fsadm: use stat to get major:minor pair for non-standard /dev layouts If we're using non-standard /dev layout so we can't get the dm-X name easily, we can't also look at the /sys/blocl/dm-X/dev to get the major:minor pair. Use "stat" in this case even though it triggers automounts (but there's no better way for now). --- diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh index 4dee15c2e..26be1025c 100755 --- a/scripts/fsadm.sh +++ b/scripts/fsadm.sh @@ -191,6 +191,13 @@ detect_fs() { read &1 && VOLUME="$DM_DEV_DIR/mapper/$SYSVOLUME" read &1 || error "Cannot get major:minor for \"$VOLUME\"" ;; + *) + STAT=$(stat --format "MAJOR=%t MINOR=%T" ${RVOLUME}) || error "Cannot get major:minor for \"$VOLUME\"" + eval $STAT + MAJOR=$((0x${MAJOR})) + MINOR=$((0x${MINOR})) + MAJORMINOR=${MAJOR}:${MINOR} + ;; esac # use null device as cache file to be sure about the result # not using option '-o value' to be compatible with older version of blkid