0

Is there a recommended for how much to compress various subvolumes based on their use purpose?

In my case, I have subvols @, @home, .snapshots/@root, .snapshots/@home, @srv, var/@log, var/@cache. This is so I can only snapshot @, and @home.

I decided on compress-force=zstd:2 as default, but compress /var/@log and .snapshots more at compress-force=zstd:5 since they probably won't affect performance. I don't know if compression will be effective on snapper snapshots though. I'm also curious how compression on cache directories (var/cache, home/username/.cache) will affect performance.

I may also create a seperate data subvol containing folders for media like games, videos, music etc. that I can symlink different OS if needed.

Probably it should also be compress-force=zstd:2 like the rest? Since a higher compression would affect performance. While compress=lzo would be giving up too much space since the data volume would be large.

Does this make sense?

An extra only tangentially related question I have is if I should create seperate subvols for /var/lib/machines, /var/lib/portables, /var/lib/docker. I read that the first two may be created automatically if needed. I also read that docker may have issues with btrfs. However I didn't find anything on if that was only due to the btrfs storage driver, and there are no problems with overlay2 on btrfs filesystem, or if there still are issues (in which case would it make sense to mount ext4 partition there in /var/lib/docker?).

EDIT: So I just ran the commands to mount those subvols (in Arch chroot) mount -o noatime,space_cache=v2,compress-force=zstd:5,subvol=var/@log /dev/nvme0n1p2 /mnt/var/log and noticed that mount -l showed it didn't let me set different compress levels, /var/log was set to compress-force=zstd:2. Is there a rule that the mount point should have the same compress options as the parent directory they are mounted to or something?

1

1 Answer 1

1

Compression flag in the first mounted subvolume will take effect.

From https://btrfs.readthedocs.io/en/latest/Compression.html:

Typically the compression can be enabled on the whole filesystem, specified for the mount point. Note that the compression mount options are shared among all mounts of the same filesystem, either bind mounts or subvolume mounts. Please refer to section MOUNT OPTIONS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .