[Solved] Uncompressed files in forcefully compressed btrfs filesystem even after defrag

I recently installed a Manjaro system in a btrfs root, enabling zstd compression with compress-force on the subvolumes. However, even after a btrfs filesystem defragment -r -czstd / , compsize -x / still reports the presence of files with compression none. The only culprit I can think of is that I mounted the subvolumes incorrectly in /etc/fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=ddcc59dc-63e9-4602-9fc0-835054e104d0 /              btrfs   subvol=@,defaults,noatime,space_cache,compress-force=zstd 0 1
UUID=ddcc59dc-63e9-4602-9fc0-835054e104d0 /home          btrfs   subvol=@home,defaults,noatime,space_cache,compress-force=zstd 0 2

Any fixes?

Manpage/btrfs(5) - btrfs Wiki

If compress-force is specified, then compression will always be attempted, but the data may end up uncompressed if the compression would make them larger.

… And…

If the first blocks written to a file are not compressible, the whole file is permanently marked to skip compression.

If compress-force is specified, then compression will always be attempted, but the data may end up uncompressed if the compression would make them larger.

So what’s the difference between compress and compress-force?

You might consider clicking the link to the man page in my previous post. :wink:

So, the difference is that while compress attempts to to evaluate if the file should be compressed only when the file is created, compress-force re-evaluates it at every write?

Yes, exactly.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.