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
This commit is contained in:
Steve Baker 2015-04-23 10:11:09 +12:00
parent 1fc2cbff50
commit ea69fb9c47

View file

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