From ea69fb9c4749560a0f86b69107a943715ca5b2f2 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Thu, 23 Apr 2015 10:11:09 +1200 Subject: [PATCH] Mount with -o nouuid for XFS base images This change uses blkid to identify the fs type during redhat-common extract-image. The image is mounted with -o nouuid for redhat/rhel images that have XFS filesystems. This is required when building images from the same base image as the host VM to avoid "Filesystem has duplicate UUID" mount failures. Change-Id: I066289fbb27733a5a555242a0e2c363d58dd27d0 Closes-Bug: 1443706 --- elements/redhat-common/bin/extract-image | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/elements/redhat-common/bin/extract-image b/elements/redhat-common/bin/extract-image index e6a361f0..57a8443d 100755 --- a/elements/redhat-common/bin/extract-image +++ b/elements/redhat-common/bin/extract-image @@ -75,7 +75,14 @@ function extract_image() { EACTION="sudo kpartx -d $WORKING/$RAW_FILE ; $EACTION" trap "$EACTION" EXIT mkdir $WORKING/mnt - sudo mount /dev/mapper/$ROOT_LOOPDEV $WORKING/mnt + if [ "xfs" = "$(sudo blkid -o value -s TYPE /dev/mapper/$ROOT_LOOPDEV)" ]; then + # mount xfs with nouuid, just in case that uuid is already mounted + MOUNTOPTS="-o nouuid" + else + MOUNTOPTS="" + fi + + sudo mount $MOUNTOPTS /dev/mapper/$ROOT_LOOPDEV $WORKING/mnt EACTION="sudo umount -f $WORKING/mnt ; $EACTION" trap "$EACTION" EXIT