ZFS in practice – verifying transparent compression –

I had read about the transparent compression that zfs offers. I wanted to verify it so I did, and sent my results off.

As we all know no experiment is valid unless verifiable. I wanted be sure that the transparent compression was actually working so I set up a sample zfs volume and purposefully made some files that i knew would compress really well. I grabbed their sizes, transferred them to another machine without zfs, and compared the size. It works.
filesystems usually suck

1. Create the zfs filesystem
[email protected]:~# zfs create rpool/ztest
[email protected]:~# zfs set mountpoint=/ztest rpool/ztest

as soon as you do this /ztest shows up in the filesystem
[email protected]:~# ls /ztest/

2. enable compression and set it use gzip at level 6 (default)
[email protected]:/ztest# zfs set compression=gzip rpool/ztest

3. create some files you know will compress well
time for i in $(seq 1 3); do echo -n “file${i} “; echo $(seq 1 10000000) >> file${i} 2>&1; done

4. check the compression ratio
[email protected]:/ztest# zfs get compressratio rpool/ztest
NAME         PROPERTY       VALUE        SOURCE
rpool/ztest  compressratio  3.69x        –

5. verify the compression is working by transferring the file to a machine without such an awesome FS, and checking the filesize there
[email protected]:/ztest# du -sh file1
23M     file1
scp -rvp /ztest/file1 [email protected]:/root/file1

[email protected]]# du -sh file1
83M    file1

Conclusion: transparent compression is working, and working rather well on a file I made to be easily compressed.

One Reply to “ZFS in practice – verifying transparent compression –”

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.