#59 Add support for resizing and mounting Btrfs filesystems
Merged 3 years ago by pwhalen. Opened 3 years ago by ngompa.
ngompa/arm-image-installer resize-btrfs  into  master

file modified
+10 -1
@@ -406,6 +406,10 @@ 

  		mkdir /tmp/root &> /dev/null

  		mount "$ROOTPART" /tmp/root &> /dev/null

  		xfs_growfs /tmp/root

+ 	elif [ "$FS_TYPE" = "btrfs" ]; then

+ 		mkdir /tmp/root &> /dev/null

+ 		mount -o subvol=root "$ROOTPART" /tmp/root &> /dev/null

+ 		btrfs filesystem resize max /tmp/root

  	elif [ "$FS_TYPE" = "ext4" ]; then

  		fsck.ext4 -fy "$ROOTPART"

  		resize2fs "$ROOTPART"
@@ -435,7 +439,12 @@ 

  if [ "$LVM_NAME" != "" ]; then

  	mount "/dev/$LVM_NAME/root" /tmp/root &> /dev/null

  else

- 	mount "$ROOTPART" /tmp/root

+ 	FS_TYPE=$(blkid "$ROOTPART" -s TYPE -o value)

+ 	if [ "$FS_TYPE" = "btrfs" ]; then

+ 		mount -o subvol=root "$ROOTPART" /tmp/root

+ 	else

+ 		mount "$ROOTPART" /tmp/root

+ 	fi

  	if [ $? -ne 0 ]; then

  		echo "Error: mount $ROOTPART /tmp/root failed"

  		exit 1

As desktop variants of Fedora are now using Btrfs for the root
filesystem, we need to be able to grow the Btrfs filesystem when
the user requests to expand the filesystem to fill the card.

Additionally, the installer script needs to be able to manipulate
the contents of the root filesystem as needed to configure it for
the target board.

Reference: https://fedoraproject.org/wiki/Changes/BtrfsByDefault

Signed-off-by: Neal Gompa ngompa13@gmail.com

This is untested in the sense that I don't have a way of actually trying this right now specifically with the ARM image installer code.

If I messed up, please tell me and help me fix it. 🙇

rebased onto 8fbb7e0

3 years ago

Pull-Request has been merged by pwhalen

3 years ago
Metadata