0

Imagine you set up your root filesystem to be btrfs with Ubuntu 14.10 defaults (one subvolume for / and one for /home) and you want to compress and deduplicate as much as possible. Which directories should be managed as a proper subvolume and disabled for compression? The two targets "compress as much as possbile" and skip compression of certain parts for performance reasons are mutually exclusive, therefore let me clarify the question:

  • Certain sets of files and directories seem to suffer from compression (e.g. dpkg takes up to 30 minutes reading the package list after update) (with zlib compression after btrfs filesystem defragment -c) disabling compression for /var/lib/dpkg/ speeds up things by factor 1000. Are there further examples for such performance impacts (dpkg's database isn't very performant).
  • Directories containing source code (/src/ and others) are good candidates for compression although they will be mostly read when the system compiles and therefore the CPU load will be high and CPU-intensive decompression has to be done. How to estimate or measure the tradeoff?
2

I believe that per-subvolume compression is not available yet. From the BTRFS wiki:

Most mount options apply to the whole filesystem, and only the options for the first subvolume to be mounted will take effect. This is due to lack of implementation and may change in the future.

This means that (for example) you can't set per-subvolume nodatacow, nodatasum, or compress using mount options. This should eventually be fixed, but it has proved to be difficult to implement correctly within the Linux VFS framework.

Unless you have information to the contrary, your plan won't work (yet).

1
  • I'd love for it to work one day though! I'd suggest that ~/Downloads would be one worth skipping compression on, and ~/Pictures. ~/Documents would probably compress well though. However, I don't think it would be worth the effort to make that many subvolumes just for compresssion - btrfs should detect if a file compresses and stop trying if it doesn't.
    – seanlano
    Apr 13 '15 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.