Ubuntu – Will btrfs automatically compress existing files when compression is enabled


I chose btrfs as the format of my / filesystem in the Ubuntu 12.04 LTS installer. After the installation completed, I added compress=lzo to the mount options in /etc/fstab and rebooted.

Will the existing files be automatically compressed now, or must I explicitly do something to cause that to happen?

Best Answer

You will have to run btrfs fi defragment to force recompression of existing data. Otherwise, only new data will be compressed.

From the FAQ:

...consider remounting with -o compress, and either rewrite particular files in-place, or run btrfs fi defragment to recompress everything. This may take a while.