Debian
zfs-fuse:啟用壓縮無效
我安裝在 Debian Wheezy zfs-fuse 文件系統上並在一個數據集(“儲存/備份”)上啟用壓縮 gzip-9。當我檢查是否在此數據集上啟用了壓縮時,它顯示為 YES:
$: zfs get compression storage/backup NAME PROPERTY VALUE SOURCE storage/backup compression gzip-9 local
但是,當我檢查壓縮率時,可以看到有
du -ah
或沒有任何壓縮。sfx get compressratio
所有文件,包括可壓縮的文件(例如文本文件),佔用的磁碟大小與未壓縮的文件完全相同:
$: zfs get compressratio storage/backup NAME PROPERTY VALUE SOURCE stor/backup compressratio 1.00x -
為什麼會出現這種情況?
這裡有一些
zfs get all
關於數據集的資訊:compressratio 1.00x - mounted yes - quota none default reservation none default recordsize 128K default mountpoint /storage/backup default sharenfs off default checksum on default compression gzip-9 local atime on default devices on default
看起來
zfs-fuse
將每 30 秒更新compressratio
一次數據,但 IO 發生有限,但由於後台 IO 或非常大的文件導致數據更新更快發生,更新還有另一個觸發器。我已經把一些測試功能放在了 gist 上。它們需要從 1.00x 開始的干淨(無文件)文件系統。
如果腳本在第一次測試時永遠暫停,那麼您的壓縮計數器永遠不會更新,並且您的安裝存在問題。
在 Debian wheezy 盒子上執行腳本:
$ uname -a Linux zfs-fuse 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686 GNU/Linux
結果如下:
$ test_compression compress Testing [compress] Testing size [4096] Waited 0 seconds for [compressratio_is_one] 4096 bytes made up of 1*4096 blocks Waited 20 seconds for [compresstario_is_not_one] 1.12x Testing size [16384] Waited 30 seconds for [compressratio_is_one] 16384 bytes made up of 1*16384 blocks Waited 30 seconds for [compresstario_is_not_one] 1.53x Testing size [1048576] Waited 30 seconds for [compressratio_is_one] 1048576 bytes made up of 1*131072 blocks Waited 30 seconds for [compresstario_is_not_one] 31.44x Testing size [33161216] Waited 30 seconds for [compressratio_is_one] 33161216 bytes made up of 255*131072 blocks Waited 0 seconds for [compresstario_is_not_one] 202.31x
您可以通過在後台執行一些可能觸發計數器更新的密集操作來將其減少大約一半。
在後台
$ while true; do touch somefile; rm somefile; done
然後再次測試:
$ test_compression compress Testing [compress] Testing size [4096] Waited 0 seconds for [compressratio_is_one] 4096 bytes made up of 1*4096 blocks Waited 5 seconds for [compresstario_is_not_one] 1.11x Testing size [16384] Waited 17 seconds for [compressratio_is_one] 16384 bytes made up of 1*16384 blocks Waited 17 seconds for [compresstario_is_not_one] 1.50x Testing size [1048576] Waited 16 seconds for [compressratio_is_one] 1048576 bytes made up of 1*131072 blocks Waited 10 seconds for [compresstario_is_not_one] 29.73x Testing size [33161216] Waited 0 seconds for [compressratio_is_one] 33161216 bytes made up of 244*131072 blocks Waited 0 seconds for [compresstario_is_not_one] 201.35x
值得注意的是,在 FreeBSD 上,更新大約每 5 秒發生一次:
$ test_compression giggidy/compress Testing [giggidy/compress] Testing size [4096] Waited 0 seconds for [compressratio_is_one] 4096 bytes made up of 1*4096 blocks Waited 4 seconds for [compresstario_is_not_one] 1.21x Testing size [16384] Waited 5 seconds for [compressratio_is_one] 16384 bytes made up of 1*16384 blocks Waited 5 seconds for [compresstario_is_not_one] 1.91x Testing size [1048576] Waited 5 seconds for [compressratio_is_one] 1048576 bytes made up of 1*131072 blocks Waited 5 seconds for [compresstario_is_not_one] 39.33x Testing size [33161216] Waited 5 seconds for [compressratio_is_one] 33161216 bytes made up of 1*131072 blocks Waited 4 seconds for [compresstario_is_not_one] 114.25x
當我可以上一個盒子時,我將添加一個基於 Solaris 的範例。