Re: worse than expected compression ratios with -o compress

Jim Faulkner
2010-01-18T16:06:23Z

On Mon, 18 Jan 2010, Jim Faulkner wrote:

> So, in summary, the compression ratios are:
> btrfs: 96%
> zip/gzip: 15%
> bzip2: 11%
> 7z: 8%
> NTFS: 41%

One minor follow up. I used "mysql < mysqldump.sql" to initially populate
the database on the btrfs filesystem. I thought that this may affect the
compression ratio, since mysql probably keeps changing the same blocks as
the sql import progresses. Compare this to the NTFS test, in which I
simply copied the populated database files onto the filesystem.

So, I created a new btrfs filesystem, mounted it with the compress option,
and simply copied my database files onto the filesystem, just like I did
on the NTFS test. This did make a small difference:
delta-9 mysql # du -h
0 ./btrfs-mysql-test/test
73G ./btrfs-mysql-test/urd
743K ./btrfs-mysql-test/mysql
73G ./btrfs-mysql-test
73G .

Filesystem Size Used Avail Use% Mounted on
/dev/sdi 187G 67G 120G 36% /var/news/mysql

This shaved another 3 GB off of the disk usage, so btrfs has now achieved
a 91% compression ratio.

This is still rather poor compared to the 41% compression ratio achieved
by NTFS. Surely btrfs should be better at compressing this data.