Merge "Handle btrfs root subvolume for fedora extract-image"

This commit is contained in:
Zuul 2022-03-14 18:54:12 +00:00 committed by Gerrit Code Review
commit bce7af6a29
1 changed files with 8 additions and 1 deletions

View File

@ -131,7 +131,8 @@ function extract_image() {
done
mkdir $WORKING/mnt
if [ "xfs" = "$(sudo blkid -o value -s TYPE $ROOT_LOOPDEV)" ]; then
ROOT_FSTYPE=$(sudo blkid -o value -s TYPE $ROOT_LOOPDEV)
if [ "xfs" = "$ROOT_FSTYPE" ]; then
# mount xfs with nouuid, just in case that uuid is already mounted
# use ro to avoid/workaround xfs uuid issues on older
# kernels with newer rhel images which seem to set
@ -139,6 +140,12 @@ function extract_image() {
# xfs superblock has incompatible features (0x4)
# we don't need to worry about this, we just want the data
MOUNTOPTS="-o nouuid,ro"
elif [ "btrfs" = "$ROOT_FSTYPE" ]; then
# Fedora has a btrfs filesystem with a subvolume called root.
# For now assume there will be a 'root' subvolume, but in the
# future the subvolume layout may need to be discovered for different
# images
MOUNTOPTS="-o subvol=root"
else
MOUNTOPTS=""
fi