Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

btrfs compression appears to do nothing

Terry PhelpsFeb 27 2013 — edited Feb 28 2013
I'm fooling around with btrfs these days, and have done some simple tests to determine what effect btrfs compression has on consumed disk space. Either my test is flawed, or I'm misinterpreting the results, or btrfs compression isn't doing ANYTHING.

Someone point out my error please:

I'm testing with kernel 2.6.39-300.28.1.el5uek, if that's a factor. Here's my test:

I created a 25G partition and mkfs'ed it as a btrfs filesystem. I didn't use any options on the mkfs. I created a subvolume (actually, three of them, but I'm only using one right now). I mounted the subvolume without any options. My /etc/fstab line said:
LABEL=BIGDISK /mirror btrfs subvol=@mirror 1 2

After populating it, I asked btrfs how much of it I'm using:
# btrfs files show /dev/sdb1
Label: 'BIGDISK' uuid: 4af2b1f7-6d02-4d50-84c5-64a2c710b1b1
Total devices 1 FS bytes used 6.84GB
devid 1 size 25.00GB used 9.52GB path /dev/sdb1

# btrfs filesys df /mirror
Data: total=9.01GB, used=6.59GB
System: total=4.00MB, used=4.00KB
Metadata: total=520.00MB, used=256.23MB

So, something over 6.5 gigs of data in use.

Then I removed all files from /mirror, added the compression option to fstab:
LABEL=BIGDISK /mirror btrfs subvol=@mirror,compress 1 2

And then umount and mount /mirror. I repeated my test. The results are the same:
# btrfs files show /dev/sdb1
Label: 'BIGDISK' uuid: 4af2b1f7-6d02-4d50-84c5-64a2c710b1b1
Total devices 1 FS bytes used 6.84GB
devid 1 size 25.00GB used 9.52GB path /dev/sdb1

Btrfs Btrfs v0.19


Changing the fstab option "compression" to "compression=lzo" or "compression-zlib" don't change the results either. I tried those.

What's going on? I"m very confused. Surely btrfs compression works in this kernel. Am I misinterpreting something?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 28 2013
Added on Feb 27 2013
6 comments
1,245 views