From 599aea272fcc70a5cc603918a2f7548db458a44c Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sat, 27 Dec 2014 00:43:24 +0100 Subject: [PATCH] btrfs-mksnapshot: Enhance detection of btrfs filesystem name --- btrfs/mksnapshot/btrfs-mksnapshot | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/btrfs/mksnapshot/btrfs-mksnapshot b/btrfs/mksnapshot/btrfs-mksnapshot index c4a4282..3386b47 100755 --- a/btrfs/mksnapshot/btrfs-mksnapshot +++ b/btrfs/mksnapshot/btrfs-mksnapshot @@ -49,12 +49,15 @@ done [ -z "$DRY_RUN" ] || echo "VOLUME_PATH=$VOLUME_PATH" # Detect btrfs filesystem -FS_NAME=`grep " btrfs " /etc/fstab \ - | grep "^LABEL=" \ - | grep " $VOLUME_PATH " \ - | cut -d'"' -f2 \ - | cut -d'=' -f2- \ - | cut -d' ' -f1` +FS_NAME=`btrfs fi sh -m / 2>/dev/null | head -1 | cut -d"'" -f2` +if [ -z "$FS_NAME" ]; then + FS_NAME=`grep " btrfs " /etc/fstab \ + | grep "^LABEL=" \ + | grep " $VOLUME_PATH " \ + | cut -d'"' -f2 \ + | cut -d'=' -f2- \ + | cut -d' ' -f1` +fi if [ -z "$FS_NAME" ]; then echo "$NAME: Failed to detect btrfs filesystem label for \"$VOLUME_PATH\"!" exit 1 -- 2.39.2