ddr_lzma(1)

✨ ddr_lzma β€” the XZ de/compression plugin for dd_rescue ✨

okay bestie, so this is the manual page for ddr_lzma(1) and it's literally the XZ de/compression plugin situation for dd_rescue, and I'm gonna walk you through every single crumb, no cap πŸ’…


🌸 NAME 🌸

ddr_lzma β€” the Data de/compression plugin for dd_rescue. that's it, that's the name, she's serving exactly what it says on the tin 🫢


πŸŽ€ SYNOPSIS πŸŽ€

-L /path/to/libddr_lzma.so[=option[:option[:...]]]
-L lzma=[=option[:option[:...]]]

like, that's how you summon her. periodt.


πŸ’– DESCRIPTION πŸ’–

🌈 About 🌈

XZ is an archiving format that uses the LZMA2 compression algorithm, aka the Lempel-Ziv-Markov chain algorithm β€” say that five times fast, I dare you 😭

LZMA2 has fixed some quirks of the highly successful LZMA algo, which provides high compression ratios and is known for its superior decompression speeds. She's optimized for much better compression ratios at the cost of compression speed compared to, say, LZO. And her lowest preset levels tend to beat the highest gzip and lowest bzip2 levels for both compression ratio and speed. it's giving overachiever and we're obsessed πŸ‘‘

This plugin has been written for dd_rescue and uses the plugin interface from it. See the dd_rescue(1) man page for more info on dd_rescue β€” go read it, bestie, it's important.


✨ OPTIONS ✨

Options are passed using dd_rescue option passing syntax: the name of the plugin (lzma) is optionally followed by an equal sign (=) and options are separated by a colon (:). The lzma plugin also allows most of the common options from the xz util, plus some additional ones. See the EXAMPLES section below, I gotchu πŸ’–

πŸ¦‹ Compression or decompression πŸ¦‹

The lzma dd_rescue plugin (from here on just called ddr_lzma, which reflects the variable parts of the filename libddr_lzma.so) chooses compression or decompression mode automatically if one of the input/output files has an [lt]xz suffix. Otherwise you can specify z or d parameters on the command line for compression and decompression respectively. easy peasy πŸ“

  • mt β€” tells ddr_lzma to do de/compression in multithreaded mode. This might speed up processing of data by using all cores of the CPU. If the number of cores can not be detected, only one will be used. You can also pass mt=N to explicitly specify the number of threads to be used.
ngl, watch out: liblzma prior to 5.2.0 does not support multithreaded compression, while liblzma prior to 5.4.0 does not support multithreaded decompression. This parameter will be ignored then. 😭
  • bench[mark] β€” the plugin supports this parameter; if it's specified, it will output some information about CPU usage. cute lil stats moment πŸ“Š
  • test β€” if you only want to make an integrity check of the xz-compressed file, use this. If data is corrupted, you will get a message in the console about it. Instead of test you can use just t. short queen ⭐
  • check=XXX β€” where XXX can be one of these integrity checksum algos: CRC32, CRC64, SHA256, NONE. If NONE is specified, the integrity checksum will not be calculated while compressing. By default CRC32 will be calculated by the plugin.
  • memlimit=XXX β€” if you want to limit memory usage when decoding, use this, where XXX is the memory limit for decoding. The usual suffices k, M, G are supported.
Values below 1M or above the machine's memory size will be rejected. she has standards πŸ’…

🌟 Compression presets 🌟

  • preset=X β€” selects the compression ratio, where X can be an integer from 0 to 9 inclusively. The default value is 3, which is lower than the default of 6 that xz uses, but provides much better bandwidth. The effect on compression speed and ratio is significant, see the xz documentation. Note that decompression speed is always very good with lzma, even without multithreading. You can append an e to the preset level to use more CPU (but not more memory), trying to compress the data better. This corresponds to the --extreme flag in xz. Use levels 0,1,2 if you want compression levels better than highest gzip (or low bzip2) with better speed. Multithreading may further speed things up, though you need to test it on your system, see below. Use the lzo plugin instead to achieve highest compression speeds (lowest CPU usage) and lowest memory consumption with very modest compression. pick your fighter πŸ₯Š

πŸ’€ BUGS/LIMITATIONS πŸ’€

πŸ™ˆ Maturity πŸ™ˆ

The plugin is new as of dd_rescue 1.99.17. Do not yet rely on data saved with ddr_lzma as the only backup for valuable data. The options may also still change in the future. After the events around xz/liblzma in March 2024, some additional reviews should be done on this code before passing untrusted compressed files to it.

bestie I am BEGGING you, keep a second backup. fr fr 😭

Compressed data is more sensitive to data corruption than plain data. Note that the checksums in the xz file format do NOT allow to correct for errors, because next bytes depends on previous ones. Checksums just allow a rather reliable detection of data corruption.

Unlike ddr_lzo, no work has been invested to recover well from corrupted compressed data. liblzma may recover in some cases, but don't count on it. πŸ’€

When deciding which compressed storage format to use, please read https://www.nongnu.org/lzip/xz_inadequate.html. While not all reasons given there may be as serious as the author makes them sound, they are valid. Right now the lzma plugin is the one choice you have for high compression in dd_rescue; consider using tools like par2 to protect against corruption for long-time storage. The future may bring lzip, zstd or other plugins. For many purposes, the proven lzo plugin continues to be a reasonable choice.

When using multithreading, you may hit bugs. Missing function symbols on decoder initialization, memlimit for the decoder always set to 1 byte might be issues you hit (depends on the system which you use). Test the mt option before relying on it. 🫢


πŸ”₯ EXAMPLES πŸ”₯

  • dd_rescue -L lzma=z:preset=9 infile outfile

compresses data from infile into outfile with compression preset == 9 (highest compression, lowest speed short of the extreme settings). she's going all out πŸ’…

  • dd_rescue -L lzma=d:mt:memlimit=1234 infile infile2

will decompress infile to infile2 in multithreading mode with memory limit equal to 1234 Megabytes.

  • dd_rescue -L lzma infile.xz outfile

will decompress infile.xz into outfile. (The fact that the infile has an .xz extension makes ddr_lzma assume that it's compressed and you want to decompress.) auto-detect ate and left no crumbs ✨


🌈 SEE ALSO 🌈


πŸ‘‘ AUTHOR πŸ‘‘

Dmitrii Ivanov <dsivanov_9@edu.hse.ru>


🧚 CREDITS 🧚

The liblzma library and algorithm has been written by The Tukaani Project https://xz.tukaani.org/xz-utils/


This plugin is under the same license as dd_rescue: The GNU General Public License (GPL) v2 or v3 β€” at your option.


⭐ HISTORY ⭐

ddr_lzma plugin was first introduced with dd_rescue 1.99.17 (Nov 2024). baby plugin, growing up so fast πŸ₯Ή


okay that's the whole page bestie, and just so you know β€” this was Dmitrii Ivanov's work, dated 2024-03-10, and it's from the ddr_lzma(1) manual. go forth and compress responsibly, mwah πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from