lrzip

提供: ArchWiki
2019年5月5日 (日) 16:15時点におけるHiromi-mi (トーク | 投稿記録)による版 (英語版と同期 (未訳部分そのまま))
ナビゲーションに移動 検索に移動

Long Range ZIP (別名 Lzma RZIP) は巨大なファイルに最適化された圧縮プログラムです。冗長性を排除する rzip と通常の圧縮 (LZMA, LZO, gzip, bzip2, ZPAQ) を組み合わせることにより、ファイルが巨大になればなるほど、高い圧縮パフォーマンスを得ることができます。特に 100MB 以上のファイルで高い効果があります。サイズを小さくするか圧縮速度を速くするかどちらかを選ぶことが可能です。

インストール

公式リポジトリlrzipインストールしてください。

使用方法

圧縮

ディレクトリを (再帰的に) 圧縮するには lrztar が必要です。最初にディレクトリが tar でまとめられてから圧縮されます。targzipxz を使って圧縮するのと同じです (tar zcf ... または tar Jcz ...)。なお、rzip と同様に、事前の圧縮処理の後に圧縮アルゴリズムが適用され、例えば一般的な LZMA 圧縮アーカイブとは異なります。

foo という名前のディレクトリから LZMA で圧縮されたアーカイブ foo.tar.lrz を作成するには:

$ lrztar foo

bar という名前のディレクトリから LZMA 圧縮アーカイブ bar.lrz を作成するには:

$ lrzip bar

圧縮率を高めたい場合、-z スイッチを追加することで ZPAQ が有効になりますが LZMA よりも長い時間がかかります:

$ lrztar -z foo

圧縮・展開の時間を高速にしたい場合、-l スイッチで LZO を使うことができます:

$ lrzip -l bar

展開

圧縮されたディレクトリを展開するには:

$ lrzuntar foo.tar.lrz

bar.lrzbar に展開するには:

$ lrunzip bar.lrz

詳細

Lrzip uses an extended version of rzip, which does a first pass long distance redundancy reduction. The lrzip modifications make it scale according to memory size. The data is then either:

  1. Compressed by LZMA (default), which gives excellent compression at approximately twice the speed of bzip2 compression
  2. Compressed by a number of other compressors chosen for different reasons, in order of likelihood of usefulness:
    1. ZPAQ: Extreme compression up to 20% smaller than LZMA, but ultra slow at compression AND decompression.
    2. LZO: Extremely fast compression and decompression, which on most machines compresses faster than disk writing making it as fast (or even faster) than simply copying a large file.
    3. GZIP: Almost as fast as LZO, but with better compression.
    4. BZIP2: A defacto linux standard of sorts, but is the middle ground between LZMA and gzip and neither here nor there.
  3. Leaving it uncompressed and rzip prepared. This form improves substantially any compression performed on the resulting file in both size and speed (due to the nature of rzip preparation merging similar compressible blocks of data and creating a smaller file). By "improving" it will either speed up the very slow compressors with minor detriment to compression, or greatly increase the compression of simple compression algorithms.

The major disadvantages are:

  1. The main lrzip application only works on single files, so it requires the lrztar wrapper to fake a complete archiver.
  2. It requires a lot of memory to get the best performance out of (as much memory as the size of the data to compress; but see the sliding mmap below), and is not really usable (for compression) with less than 256MB. Decompression requires less ram and works on smaller ram machines. Sometimes swap may need to be enabled on these lower ram machines for the operating system to be happy.
  3. STDIN/STDOUT works fine on both compression and decompression, but larger files compressed in this manner will end up being less efficiently compressed.

The unique feature of lrzip is that it tries to make the most of the available ram in your system at all times for maximum benefit. It does this by default, choosing the largest sized window possible without running out of memory. It also has a unique "sliding mmap" feature which makes it possible to even use a compression window larger than your ramsize, if the file is that large. It does this (with the -U option) by implementing one large mmap buffer as per normal, and a smaller moving buffer to track which part of the file is currently being examined, emulating a much larger single mmapped buffer. Unfortunately, this mode can be many times slower.

参照