Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BtrFS support #167

Open
thomastthai opened this issue Dec 6, 2023 · 2 comments
Open

BtrFS support #167

thomastthai opened this issue Dec 6, 2023 · 2 comments

Comments

@thomastthai
Copy link

thomastthai commented Dec 6, 2023

How well is btrfs supported for the Raspberry Pi if the root partition was converted to btrfs from ext4?

btrfs partition resize is unlikely to work with resizefs or e2fsck and would require the btrfs-progs package to resize:

btrfs filesystem resize amount /mount-point
@jonathanmarchuot
Copy link

This is also currently a headache of mine -- patching Ubuntu images that Libre Computer is publishing with btrfs supported. I would love to see btrfs resizing supported by the project in the future!

Currently, the way I've found around this, is by making sure your json gets rid of the "target_image_size", and then resize your source image prior to running packer.

truncate --size=+1400M ./original.img

sudo losetup --show -f -P ./original.img
#	'/dev/loop3'

sudo parted /dev/loop3
#	'print'
#		Disk /dev/loop3: 7213MB
#		part 2 end 2809MB size 2540MB
#
#      ((take the disk size '7213' above, then resize the partition to take the full space))
#	'resizepart 2'
#		End?  [2809MB]?
#		'7213MB'
#
#	'print'
#		Disk /dev/loop3: 7213MB
#		part 2 end 7213MB size 6944MB
#
#	'quit'

sudo mkdir -p /btrfs
sudo mount /dev/loop3p2 /btrfs

sudo btrfs filesystem resize max /btrfs
sudo btrfs filesystem show
sudo btrfs check --force /dev/loop3p2

sudo umount /btrfs
sudo losetup -d /dev/loop3

shasum -a 256 ./original.img

And then take your "new" original.img with your new shasum and run packer against that. Good luck!

@thomastthai
Copy link
Author

thomastthai commented Dec 6, 2023

@jonathanmarchuot, thanks for sharing your workaround!

Does your root partition come with btrfs as default?

For the Raspberry Pi Bookworm, I manually convert the factory image's root partion from ext4 to btrfs. I haven't found an automated way to do that conversion via Vagrant and Packer.

Are you doing the workaround manually or automated via code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants