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

Use btrfs with compress to further reduce storage consumption #23

Open
RadxaYuntian opened this issue Jul 6, 2023 · 6 comments
Open

Comments

@RadxaYuntian
Copy link

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.

@easimon
Copy link
Owner

easimon commented Jul 7, 2023

Sounds interesting. Do you have any ballpark figures, how good the compression works and how compression affects CPU usage?

@RadxaYuntian
Copy link
Author

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.

@easimon
Copy link
Owner

easimon commented Jul 22, 2023

That could be an interesting option for those requiring even more space.

Would you mind creating a merge request with btrfs as an option?

@mirage335
Copy link

mirage335 commented Sep 8, 2023

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

@mirage335
Copy link

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

@libenc
Copy link

libenc commented Mar 2, 2024

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.

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

No branches or pull requests

4 participants