diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-18 15:55:36 +0100 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-18 17:21:47 +0100 |
commit | 6c10d1f3d95dc0f7ac55fe55be0115a9fc438da5 (patch) | |
tree | 7b60b63dacb9473500f4ded82e615587c6da8c26 | |
parent | 2879eff86edb944874c7a1bf580b851286c4da46 (diff) | |
download | lvm2-6c10d1f3d95dc0f7ac55fe55be0115a9fc438da5.tar.gz |
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).
-rwxr-xr-x | scripts/fsadm.sh | 7 |
1 files changed, 7 insertions, 0 deletions
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 </sys/block/${RVOLUME#/dev/}/dm/name SYSVOLUME 2>&1 && VOLUME="$DM_DEV_DIR/mapper/$SYSVOLUME" read </sys/block/${RVOLUME#/dev/}/dev MAJORMINOR 2>&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 |