1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 01:55:10 +03:00

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).
This commit is contained in:
Peter Rajnoha 2016-03-18 15:55:36 +01:00
parent 2879eff86e
commit 6c10d1f3d9

View File

@ -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