2

I can do:

btrfs filesystem defragment -rvf -czstd ./

But not:

btrfs filesystem defragment -rvf -czstd:1 ./

I get the error:

ERROR: unknown compression type zstd:1

Is there any way to change the compression level of my files?

I have already modified the mount option in fstab config file:

UUID=7e73aae9-1da1-4ea6-b8a5-20f5c2689f23  /  btrfs  defaults,subvol=@,ssd,autodefrag,noatime,space_cache,commit=15,compress-force=zstd:1  0  0

But it did not affect the already existing files.

Also, how to check the compression level of a file?

1 Answer 1

1

Running defragment with a compression level is unsupported as of this writing (see: this issue with patch).

Supposedly defragment will respect the compression mount options, but I've tested this and was found not to be true, even with compress-force. Perhaps it is true only under certain conditions.

Is there any way to change the compression level of my files?

BTRFS compression is done at the extent level, not file. So its possible for a file to be partially compressed with all compression algorithms. And yes, extent compression can be changed by rewriting the extent (or file) data with mount compression enabled. Alternatively, with the above mentioned patch one might be able to add compression level to defragment (requires kernel recompile).

Also, how to check the compression level of a file?

The compsize tool can be used to check compression ratios on a set of files/directories and will show ratios for each used compression algorithm.

You must log in to answer this question.

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