]> git.ipfire.org Git - thirdparty/systemd.git/commit
repart: Force --rootdir population for btrfs with compression
authorChris Down <chris@chrisdown.name>
Thu, 6 Nov 2025 15:17:01 +0000 (23:17 +0800)
committerChris Down <chris@chrisdown.name>
Fri, 7 Nov 2025 10:17:08 +0000 (18:17 +0800)
commitf30a29245d8ff4509c95bef817944299efbc3795
treec8bad172f5b1c7103e303ba43dd821fa1fee34a6
parentadf88771ff0c11fb0e51ef14f129d584fb471420
repart: Force --rootdir population for btrfs with compression

When a btrfs partition is configured with both Compression= and
CopyFiles=, we need to ensure files are copied during filesystem
creation using mkfs.btrfs --rootdir, rather than copying files
afterwards via loop device mounting.

This is required because mkfs.btrfs can only apply compression settings
when files are provided via --rootdir during filesystem creation. If we
format the filesystem first and then mount it to copy files, the
compression setting is meaningless.

Modify the partition_needs_populate() condition to force the --rootdir
code path when the format is btrfs and compression is requested.

This ensures that partition_populate_directory() runs and creates a
temporary directory with the files, which is then passed to
make_filesystem() as the root parameter, allowing mkfs.btrfs to create
the filesystem with compression applied.

Fixes: https://github.com/systemd/systemd/issues/39584
src/repart/repart.c