systemd / systemd

The systemd System and Service Manager
https://systemd.io
GNU General Public License v2.0
12.81k stars 3.68k forks source link

Configure compression in repart.d file (squashfs, erofs, btrfs) #32737

Open septatrix opened 1 month ago

septatrix commented 1 month ago

Component

systemd-repart

Is your feature request related to a problem? Please describe

SquashFS and EROFS support different compression algorithms which influence compression ration and speed. Having control over these settings is important when creating disk images using e.g. mkosi.

Similarly BTRFS supports online compression. While this is a mount option and makes no difference for empty volumes, as soon as one starts to fill it using CopyFiles= there is no method to enable compression for these files meaning these files will always be uncompressed if filled my repartd. Instead, one would have to create the btrfs manually, mount if using the proper options, then fill it, and optionally shrink it afterwards.

Describe the solution you'd like

A new option CompressionAlgorithm= should be added to the repart.d config files to set configure these values.

Describe alternatives you've considered

One could also use $SYSTEMD_REPART_MKFS_OPTIONS_<FSTYPE>. For one time operations this might be acceptable but it quickly becomes unmaintainable as one must not forget to set the option and write it down somewhere. It is also way more convoluted when using e.g. systemd-repart.service and splits configuration into several places. AFAIK this workaround also does not work with BTRFS.

The systemd version you checked that didn't have the feature you are asking for

255

TobiPeterG commented 5 days ago

I would also like to see this, though it wouldn't need to be limited to ccompression, why not support providing extra mount options for the partition that is about to be created.