maximize-build-space
maximize-build-space copied to clipboard
Use btrfs with compress to further reduce storage consumption
Before I knew this action I was using btrfs with compress to workaround my own space issue. I see this action is still using ext4, so this could be another way to accommodate large projects.
Sounds interesting. Do you have any ballpark figures, how good the compression works and how compression affects CPU usage?
In my old action I used zstd compression, and by default btrfs uses compress level 3. Some old benchmark show that it can yield about 42% space saving. Running at full speed zstd is said to consume 20-30% CPU cycles, but such heavy IO operation shouldn't occur too often for normal workflows.
That could be an interesting option for those requiring even more space.
Would you mind creating a merge request with btrfs as an option?
I would very greatly appreciate this, and can confirm BTRFS compression plays nice with GitHub Actions and 'maximize-build-space'. Since I am already running a compressed BTRFS ChRoot on a loopback image within GitHub Actions after the 'maximize-build-space' step. Yes, the kernels used by GitHub Actions have full support and all.
This would improve my margins from only a few gigabytes, to a several more gigabytes. Compression is a good upwards of 30%-50%, and much, much more importantly, compression eliminates unused disk space from loopback filesystems in which a 'dd if=/dev/zero of=./fill' has been applied recently.
EDIT: You might find relevant code scattered around relevant shell code projects I do some work on... https://github.com/soaringDistributions/ubDistBuild/blob/main/ubiquitous_bash.sh https://github.com/mirage335-colossus/ubiquitous_bash/blob/c70169e4e512b07d6699c64339e7bd7e9c5c4d6a/virtualization/bios/createvm.sh
Looks like this line could change to use btrfs instead of ext4 :
https://github.com/easimon/maximize-build-space/blob/master/action.yml#L176
And this line could enable compression :
https://github.com/easimon/maximize-build-space/blob/master/action.yml#L181
I've made some progress on my fork libenc/maximize-build-space@add-btrfs-support. These changes have actually been running for a while in my private projects brefore this fork and have shown to be stable enough, so I decided to share them out. Since there is already a PR #37 about this issue, I'll wait for some feedback, and add some docs related if needed.
As turning on the compression with BTRFS may have a large performance impact and also for compatibility reasons, an option has been added to explicitly turn on the BTRFS (use-btrfs) and provide options for tuning the compression algorithm and levels. So these changes will not have an unexpected impact on existing users.