I have a partition formated to btrfs and im willing to store there stuff that I don't use that often but which I need fast access from time to time (some dumps of my PS2 games for now) because I have read that btrfs can work wonders compressing data on the fly.

The thing is even when mounting this partition using the compress-force=zlib option I can't notice any compression work at all.

Currently my /etc/fstab file display the following info for the drive in question:

LABEL=Emu /mnt/Emu btrfs compress-force=zlib,nosuid,nodev,nofail,comment=x-gvfs-show 0 0

The drive mounts fine and data can be written and read back. But no compression work is done, not with old files nor with new ones.

So far I've tested it by doing the following:

$ sudo dd if=/dev/sda6 of='/mnt/Emu/dummy.txt' bs=1M count=1024
$ sudo btrfs fi sync /mnt/Emu
$ sudo du -h '/mnt/Emu/dummy.txt'

This generated a 1 GB file in said drive and told me the size of the file is indeed 1 GB so nothing has been compressed.

Also verified the size after using chattr +c on said dummy file and then defragmenting the file/drive by using btrfs fi defragment on them.

Any pointing?

My systems specs:

  • OS: Ubuntu 14.04 x86_64
  • Kernel: 3.13.0-40-generic
  • Btrfs: v3.12

See Will btrfs automatically compress existing files when compression is enabled? on best practices compressing with btrfs:

  1. The command is btrfs fi defrag not btrfs fi sync
  2. it must be applied to file, btrfs fi defrag /mnt/Emu/dummy.txt not to dir
  3. how exactly do you decide it is not compressed? df is not showing proper sizes.
  • Hi! 1 & 2 was already used as you can observe above. And no, was reading the sizes all the time via du command. But now that you mentioned it, paying attention todf output I see what seems to be the correct size of space used, I suppose du can't tell the true size on disk for a file, is it true?, Do you know a way to tell the compressed ratio of a file? – eridani Dec 2 '14 at 21:41
  • Can I find out compression ratio of a file? Currently no. There's a patchset thread.gmane.org/gmane.comp.file-systems.btrfs/37312 that extends the FIEMAP interface to return the physical length of an extent (ie. the compressed size). btrfs.wiki.kernel.org/index.php/… – Yonsy Solis Apr 12 '16 at 19:43

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.