maximize-build-space icon indicating copy to clipboard operation
maximize-build-space copied to clipboard

feat: use btrfs with zstd compression

Open theoparis opened this issue 1 year ago • 1 comments

I specified zstd level 13 here, but I'm not sure that it is the best compression level in terms of maintaining performance. I did not make an option to keep ext4, so please let me know if that is an issue. Btrfs doesn't accept -m0 options so I removed them from the command.

This may solve #23

My Use Case

I am trying to build chromium with github actions and it ran out of disk space and then I came across this repository. After adding the btrfs option and using the action it seems to have helped significantly. However I'm still not sure if chromium will fit in the 6 hour time frame that github runners provide. I haven't seen anyone try this before...

theoparis avatar Jan 26 '24 07:01 theoparis

The "overprovision lvm" option is not translated to btrfs in your PR. On ext4, it's a mkfs option, on btrfs it is a mount option.

The consequence of activating "discard" on ext4 is, that the underlying disk image files become sparse, which means the files are smaller than their maximum file system size, until they fill up -- which can lead to unexpected and unforseeable "no space left on device" when the image tries to expand but the root fs has not enough space left.

This is why I made that an option (defaulting to false). I do not know if btrfs behaves similar with discard activated -- could you please check what "df" says on the root device after creating and mounting the btrfs -- and maybe move around the "if", so btrfs gets mounted with nodiscard when the option is set to false?

And regarding compression: this should as well be an option with a conservative default (i.e. no compression by default)

easimon avatar Jan 26 '24 23:01 easimon

"discard" behaviour can be specified in mount options; level 13 seems too much for me; it might be helpful to have an option to enable compress-force instead of compress and an option to choose between ext4 and btrfs

mio-19 avatar Sep 11 '25 05:09 mio-19

default profile of metadata is DUP. let's add -m single -d single to mkfs.btrfs

mio-19 avatar Sep 11 '25 05:09 mio-19

Sorry, I totally forgot about this PR. I updated it with some untested changes for now.

theoparis avatar Sep 11 '25 06:09 theoparis