]> sourceware.org Git - lvm2.git/commitdiff
fsadm: use stat to get major:minor pair for non-standard /dev layouts
authorPeter Rajnoha <prajnoha@redhat.com>
Fri, 18 Mar 2016 14:55:36 +0000 (15:55 +0100)
committerPeter Rajnoha <prajnoha@redhat.com>
Fri, 18 Mar 2016 16:21:47 +0000 (17:21 +0100)
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).

scripts/fsadm.sh

index 4dee15c2ed0d16fba329ff42e1a49ff24467de78..26be1025c8c31f0f80f69b5e55e0f8d0e0bcf608 100755 (executable)
@@ -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
This page took 0.03822 seconds and 5 git commands to generate.