ZFS Compression
Jing, mqjing@gmail.com
現代的 file system 非常的強大,除了上次介紹的 zfs deduplication (自動用 hash code 代替重復的 blocks, 以達成有效利用儲存空間). 還有 snapshot 功能,你可以隨時回復上一動。另外,還有 on the fly的自動壓縮功能。你可以指定專門存放 VM image 的 pool 用 deduplication, user home pool 用 lz4 壓縮,專門放 user data 的 pool 使用 deduplication + compression. 巨量的節省使用空間。
想驗證,只要比對 ls 與 du 的結果,就能知道你的成效。身在這個時代,真好^_^
Introduction
LZ4 Performance*
* DataSet: Silesia Corpus test set
* The testing zpool was backed by a ramdisk so as to avoid hitting any IO subsystem bottlenecks and show pure LZ4 on ZFS throughput
Introduction
How to check compression property
Enable
zfs get compressratio <pool>
Check the difference in size
zfs create -o compression=off rpool/test
cd /rpool/test
cp /bigfile bigfile1
zfs set compression=on rpool/test
cp /bigfile bigfile2
Check the difference in size
zfs get compressratio rpool/test
du -hs big*
ls does not show the compressed file size!
Another example
Check the performance in time
Command
time dd if=/dev/urandom of=/target.txt bs=1M count=1024
Check the I/O performance
Throughput
Command
sudo zpool iostat -v
Upgrade ZFS
Command
sudo zfs upgrade my_pool
Example
References
Further Information