On Mon, Mar 21, 2011 at 11:24 PM, Stephane Chazelas <stephane.chaze...@gmail.com> wrote: > AFAICT, compression is enabled at mount time and would > only apply to newly created files. Is there a way to compress > files already in a btrfs filesystem?
You need to select the files manually (not possible to select a directory), but yes, it's possible using "btrfs filesystem defragment -c" # mount -o loop /tmp/test.img /mnt/tmp # cd /mnt/tmp # dd if=/dev/zero of=100M.bin bs=1M count=100;sync;df -h . 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 1.20833 s, 86.8 MB/s Filesystem Size Used Avail Use% Mounted on /dev/loop0 1.0G 101M 794M 12% /mnt/tmp # /sbin/btrfs fi de -c /mnt/tmp/100M.bin;sync;df -h . Filesystem Size Used Avail Use% Mounted on /dev/loop0 1.0G 3.5M 891M 1% /mnt/tmp For a whole filesystem, you might be able to automate it using shell script with "find . -type f ..." -- Fajar -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html