Clonezilla LZ4、zstd 壓縮參數測試&建議

62 views
Skip to first unread message

otto...@gmail.com

unread,
Nov 5, 2021, 11:56:56 PM11/5/21
to 再生龍clonezilla
最近有空做了一下 LZ4、zstd 壓縮測試,來源是 Windows 10 + Office 2021 + 一些軟體,透過 1Gb 網芳還原,結果如下表:


WeChat 圖片_20211106111642.png

可以看到預設的 zstd 3 在壓縮比、速度上都有滿好的平衡,壓縮速度也還可以接受,不過LZ4 在建議的高壓縮比(-9)下,解壓縮速度比起 zstd 快大約 15%,雖然壓縮可能需要 zstd 約 2 ~ 3 倍的時間,不過對於不需要很常製作映像檔的環境中,提昇還原速度還算有用。

所以想說能不能在 ocs-sr 參數中,加入可以調整壓縮參數或解壓縮參數的變數,像是 ocs_compress_opt,方便測試不同的壓縮參數,不用每次都進去改 drbl-ocs.conf 檔案改 extra_*_opt 的參數。

Steven Shiau

unread,
Nov 9, 2021, 8:30:38 AM11/9/21
to ocs-clo...@googlegroups.com
可以用ocs_prerun來做相關調整,例如:
ocs_prerun="perl -pi -e 's/^extra_lz4_opt=.*/extra_lz4_opt=-9/'
/etc/drbl/drbl-ocs.conf"

Steven

On 11/6/21 11:40 AM, otto...@gmail.com wrote:
> 最近有空做了一下 LZ4、zstd 壓縮測試,來源是 Windows 10 + Office 2021 +
> 一些軟體,透過 1Gb 網芳還原,結果如下表:
>
>
> WeChat 圖片_20211106111642.png
>
> 可以看到預設的 zstd 3
> 在壓縮比、速度上都有滿好的平衡,壓縮速度也還可以接受,不過LZ4
> 在建議的高壓縮比(-9)下,解壓縮速度比起 zstd 快大約
> 15%,雖然壓縮可能需要 zstd 約 2 ~ 3
> 倍的時間,不過對於不需要很常製作映像檔的環境中,提昇還原速度還算有用。
>
> 所以想說能不能在 ocs-sr
> 參數中,加入可以調整壓縮參數或解壓縮參數的變數,像是
> ocs_compress_opt,方便測試不同的壓縮參數,不用每次都進去改 drbl-ocs.conf
> 檔案改 extra_*_opt 的參數。
> --
> 這是 Google 網路論壇針對「再生龍clonezilla」群組發送的訂閱通知郵件。
> 如要取消訂閱這個群組並停止接收來自這個群組的郵件,請傳送電子郵件到
> ocs-clonezill...@googlegroups.com
> <mailto:ocs-clonezill...@googlegroups.com>。
> 如要在網路上查看這項討論,請造訪
> https://groups.google.com/d/msgid/ocs-clonezilla/fdd6eed7-8ee4-4c7f-8fa3-f64d307c892fn%40googlegroups.com
> <https://groups.google.com/d/msgid/ocs-clonezilla/fdd6eed7-8ee4-4c7f-8fa3-f64d307c892fn%40googlegroups.com?utm_medium=email&utm_source=footer>。

--
Steven Shiau <steven _at_ stevenshiau org>
Public Key Server PGP Key ID: 4096R/163E3FB0
Fingerprint: EB1D D5BF 6F88 820B BCF5 356C 8E94 C9CD 163E 3FB0

otto...@gmail.com

unread,
Nov 10, 2021, 2:41:54 AM11/10/21
to 再生龍clonezilla
那問一下,解壓縮的時候也有參數可以調整嗎?因為如果用 zstd --long 模式壓縮,--long=27 以上,解壓縮就需要加入對應的 --long,參見說明:

--long[=#]: enables long distance matching with # windowLog, if not # is not present it defaults to 27. This increases the window size (windowLog) and memory usage for both the compressor and decompressor. This setting is designed to improve the compression ratio for files with long matches at a large distance. Note: If windowLog is set to larger than 27,

--long=windowLog or --memory=windowSize needs to be passed to the decompressor.

Steven Shiau 在 2021年11月9日 星期二下午9:30:38 [UTC+8] 的信中寫道:

otto...@gmail.com

unread,
Nov 12, 2021, 4:33:08 AM11/12/21
to 再生龍clonezilla
測試了一下,發現這個不能用,因為 PXELINUX 的 MENU 沒辦法在選項中逃離雙引號,目前還沒測試出來,所以沒辦法取代像是 extra_lz4_opt="-9"這種字串

Steven Shiau 在 2021年11月9日 星期二下午9:30:38 [UTC+8] 的信中寫道:
可以用ocs_prerun來做相關調整,例如:

Steven Shiau

unread,
Nov 12, 2021, 7:41:25 AM11/12/21
to ocs-clo...@googlegroups.com
你是如何放ocs_prerun參數的?
請完整顯示一下其內容,或者你的/proc/cmdline內容。
另外,由於/etc/ocs/ocs-live.conf的參數會優先於/etc/drbl/drbl-ocs.conf,所以,其實也可以這樣做:
ocs_prerun="echo extra_lz4_opt=\'-9\' >> /etc/ocs/ocs-live.conf"

Steven
> <https://groups.google.com/d/msgid/ocs-clonezilla/fdd6eed7-8ee4-4c7f-8fa3-f64d307c892fn%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ocs-clonezilla/fdd6eed7-8ee4-4c7f-8fa3-f64d307c892fn%40googlegroups.com?utm_medium=email&utm_source=footer>>。
>
>
> --
> Steven Shiau <steven _at_ stevenshiau org>
> Public Key Server PGP Key ID: 4096R/163E3FB0
> Fingerprint: EB1D D5BF 6F88 820B BCF5 356C 8E94 C9CD 163E 3FB0
>
> --
> 這是 Google 網路論壇針對「再生龍clonezilla」群組發送的訂閱通知郵件。
> 如要取消訂閱這個群組並停止接收來自這個群組的郵件,請傳送電子郵件到
> ocs-clonezill...@googlegroups.com
> <mailto:ocs-clonezill...@googlegroups.com>。
> 如要在網路上查看這項討論,請造訪
> https://groups.google.com/d/msgid/ocs-clonezilla/c9d7cac4-1bac-408f-90f6-4d3e6febf952n%40googlegroups.com
> <https://groups.google.com/d/msgid/ocs-clonezilla/c9d7cac4-1bac-408f-90f6-4d3e6febf952n%40googlegroups.com?utm_medium=email&utm_source=footer>。

Steven Shiau

unread,
Nov 12, 2021, 7:46:49 AM11/12/21
to ocs-clo...@googlegroups.com
謝謝詢問。這部份目前沒有,後續找時間把這部份加上去。

Steven

On 11/10/21 3:41 PM, otto...@gmail.com wrote:
> 那問一下,解壓縮的時候也有參數可以調整嗎?因為如果用 zstd --long
> 模式壓縮,--long=27 以上,解壓縮就需要加入對應的 --long,參見說明:
>
> *--long[=#]*: enables long distance matching with *#* *windowLog*, if
> not *#* is not present it defaults to *27*. This increases the window
> size (*windowLog*) and memory usage for both the compressor and
> decompressor. This setting is designed to improve the compression
> ratio for files with long matches at a large distance. Note: If
> *windowLog* is set to larger than 27, *
> *
> *
> *
> *--long=windowLog* or *--memory=windowSize* needs to be passed to the
> <https://groups.google.com/d/msgid/ocs-clonezilla/fdd6eed7-8ee4-4c7f-8fa3-f64d307c892fn%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ocs-clonezilla/fdd6eed7-8ee4-4c7f-8fa3-f64d307c892fn%40googlegroups.com?utm_medium=email&utm_source=footer>>。
>
>
> --
> Steven Shiau <steven _at_ stevenshiau org>
> Public Key Server PGP Key ID: 4096R/163E3FB0
> Fingerprint: EB1D D5BF 6F88 820B BCF5 356C 8E94 C9CD 163E 3FB0
>
> --
> 這是 Google 網路論壇針對「再生龍clonezilla」群組發送的訂閱通知郵件。
> 如要取消訂閱這個群組並停止接收來自這個群組的郵件,請傳送電子郵件到
> ocs-clonezill...@googlegroups.com
> <mailto:ocs-clonezill...@googlegroups.com>。
> 如要在網路上查看這項討論,請造訪
> https://groups.google.com/d/msgid/ocs-clonezilla/b0fc4cde-b5e6-4d30-bcee-277753525a47n%40googlegroups.com
> <https://groups.google.com/d/msgid/ocs-clonezilla/b0fc4cde-b5e6-4d30-bcee-277753525a47n%40googlegroups.com?utm_medium=email&utm_source=footer>。

otto...@gmail.com

unread,
Nov 12, 2021, 9:15:20 PM11/12/21
to 再生龍clonezilla
之前用這樣:ocs_prerun2="perl -pi -e 's/^extra_lz4mt_opt=.*/extra_lz4mt_opt="-9"/' /etc/drbl/drbl-ocs.conf",但是無法執行。

後來想說是不是要用跳脫字元: ocs_prerun2="perl -pi -e 's/^extra_lz4mt_opt=.*/extra_lz4mt_opt=\"-9\"/' /etc/drbl/drbl-ocs.conf" ,但是一樣不能執行。

改 ocs-live.conf 不用跳脫字元,應該會可以,我再試試看。



Steven Shiau 在 2021年11月12日 星期五下午8:41:25 [UTC+8] 的信中寫道:

Steven Shiau

unread,
Nov 12, 2021, 9:17:35 PM11/12/21
to ocs-clo...@googlegroups.com
-9只是單一個字,沒有空格,不需要雙引號。也就是:

ocs_prerun="perl -pi -e 's/^extra_lz4_opt=.*/extra_lz4_opt=-9/'
/etc/drbl/drbl-ocs.conf"

Steven

> <https://groups.google.com/d/msgid/ocs-clonezilla/c9d7cac4-1bac-408f-90f6-4d3e6febf952n%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ocs-clonezilla/c9d7cac4-1bac-408f-90f6-4d3e6febf952n%40googlegroups.com?utm_medium=email&utm_source=footer>>。
>
>
> --
> Steven Shiau <steven _at_ stevenshiau org>
> Public Key Server PGP Key ID: 4096R/163E3FB0
> Fingerprint: EB1D D5BF 6F88 820B BCF5 356C 8E94 C9CD 163E 3FB0
>
> --
> 這是 Google 網路論壇針對「再生龍clonezilla」群組發送的訂閱通知郵件。
> 如要取消訂閱這個群組並停止接收來自這個群組的郵件,請傳送電子郵件到
> ocs-clonezill...@googlegroups.com
> <mailto:ocs-clonezill...@googlegroups.com>。
> 如要在網路上查看這項討論,請造訪
> https://groups.google.com/d/msgid/ocs-clonezilla/4b8444be-706b-48f4-93d8-9a2f52ab6abcn%40googlegroups.com
> <https://groups.google.com/d/msgid/ocs-clonezilla/4b8444be-706b-48f4-93d8-9a2f52ab6abcn%40googlegroups.com?utm_medium=email&utm_source=footer>。

otto...@gmail.com

unread,
Nov 13, 2021, 6:19:19 PM11/13/21
to 再生龍clonezilla
這邊測試用改 /etc/ocs/ocs-live.conf 的方式可以,那就用這個方式來測試,感謝

另外 zstd 解壓縮參數的部份,應該可以類似設定像 extra_zstdmt_decompress_opt 的變數,到時候再用修改 .conf 檔案來使用就好

會想這個測試主要是 zstd 1.5 有提昇了 --long 模式下的解壓縮速度,目前 debian 還沒收錄,之後收錄也許就會用到 --long 模式

Steven Shiau 在 2021年11月12日 星期五下午8:41:25 [UTC+8] 的信中寫道:
你是如何放ocs_prerun參數的?

otto...@gmail.com

unread,
Nov 13, 2021, 6:19:41 PM11/13/21
to 再生龍clonezilla
所以在 extra_lz4_opt中,後面是不用引號的嗎?原本 drbl-ocs.conf 是都有引號的

Steven Shiau 在 2021年11月13日 星期六上午10:17:35 [UTC+8] 的信中寫道:

Steven Shiau

unread,
Nov 15, 2021, 7:40:13 AM11/15/21
to ocs-clo...@googlegroups.com
之後有機會會嘗試加上去。

Steven
> <https://groups.google.com/d/msgid/ocs-clonezilla/c9d7cac4-1bac-408f-90f6-4d3e6febf952n%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ocs-clonezilla/c9d7cac4-1bac-408f-90f6-4d3e6febf952n%40googlegroups.com?utm_medium=email&utm_source=footer>>。
>
>
> --
> Steven Shiau <steven _at_ stevenshiau org>
> Public Key Server PGP Key ID: 4096R/163E3FB0
> Fingerprint: EB1D D5BF 6F88 820B BCF5 356C 8E94 C9CD 163E 3FB0
>
> --
> 這是 Google 網路論壇針對「再生龍clonezilla」群組發送的訂閱通知郵件。
> 如要取消訂閱這個群組並停止接收來自這個群組的郵件,請傳送電子郵件到
> ocs-clonezill...@googlegroups.com
> <mailto:ocs-clonezill...@googlegroups.com>。
> 如要在網路上查看這項討論,請造訪
> https://groups.google.com/d/msgid/ocs-clonezilla/9fb3a1da-6a7d-4fde-a517-b1e793266fb9n%40googlegroups.com
> <https://groups.google.com/d/msgid/ocs-clonezilla/9fb3a1da-6a7d-4fde-a517-b1e793266fb9n%40googlegroups.com?utm_medium=email&utm_source=footer>。

Steven Shiau

unread,
Nov 15, 2021, 7:41:24 AM11/15/21
to ocs-clo...@googlegroups.com
若要指定的內容沒有空白,不需要引號沒關係。一樣可以指定給變數 extra_lz4_opt。

Steven
> <https://groups.google.com/d/msgid/ocs-clonezilla/4b8444be-706b-48f4-93d8-9a2f52ab6abcn%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ocs-clonezilla/4b8444be-706b-48f4-93d8-9a2f52ab6abcn%40googlegroups.com?utm_medium=email&utm_source=footer>>。
>
>
> --
> Steven Shiau <steven _at_ stevenshiau org>
> Public Key Server PGP Key ID: 4096R/163E3FB0
> Fingerprint: EB1D D5BF 6F88 820B BCF5 356C 8E94 C9CD 163E 3FB0
>
> --
> 這是 Google 網路論壇針對「再生龍clonezilla」群組發送的訂閱通知郵件。
> 如要取消訂閱這個群組並停止接收來自這個群組的郵件,請傳送電子郵件到
> ocs-clonezill...@googlegroups.com
> <mailto:ocs-clonezill...@googlegroups.com>。
> 如要在網路上查看這項討論,請造訪
> https://groups.google.com/d/msgid/ocs-clonezilla/7f337d85-fdca-4ddf-95da-ee18d71e8807n%40googlegroups.com
> <https://groups.google.com/d/msgid/ocs-clonezilla/7f337d85-fdca-4ddf-95da-ee18d71e8807n%40googlegroups.com?utm_medium=email&utm_source=footer>。

otto...@gmail.com

unread,
Nov 17, 2021, 12:33:38 AM11/17/21
to 再生龍clonezilla
補充一下,如果在 grub.cfg 中,不用跳脫單引號,直接用單引號即可,用跳脫字元反而會寫入錯誤,所以 grub.cfg 應該用下面的方式:

ocs_prerun="echo extra_lz4_opt='-9' >> /etc/ocs/ocs-live.conf"

Steven Shiau 在 2021年11月12日 星期五下午8:41:25 [UTC+8] 的信中寫道:
你是如何放ocs_prerun參數的?

Steven Shiau

unread,
Nov 17, 2021, 2:33:09 AM11/17/21
to ocs-clo...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages