# Lrzip

> compression program with a very high compression ratio

**Wikidata**: [Q116621454](https://www.wikidata.org/wiki/Q116621454)  
**Source**: https://4ort.xyz/entity/lrzip

## Summary
Lrzip is a free, open-source file-compression program that achieves unusually high compression ratios by combining rzip’s long-range redundancy detection with lzma, lzma –fast, gzip, bzip2, or zpaq back-end codecs. Written and maintained by Australian physician-programmer Con Kolivas, it is available for Linux, BSD and macOS and is packaged in every major Linux distribution.

## Key Facts
- Maintained by Con Kolivas; copyright © Con Kolivas (licensed GPL-2.0-or-later).
- Current stable release: 0.651 (released 8 Mar 2022); previous 0.650 (27 Feb 2022).
- File extensions: .lrz and .tar.lrz.
- Packaged as: Debian/Ubuntu “lrzip”, Fedora/Arch “lrzip”, FreeBSD port “archivers/lrzip”, Gentoo “app-arch/lrzip”, Homebrew “lrzip”, Guix “lrzip”.
- Source code: https://github.com/ckolivas/lrzip; issue tracker: https://github.com/ckolivas/lrzip/issues.
- Homepage: http://lrzip.kolivas.org/ (mirror docs at http://ck.kolivas.org/apps/lrzip/README.md).
- Runs on: Linux, BSD and macOS.
- Free software directory entry: “Lrzip”.

## FAQs
### Q: What makes lrzip different from gzip or xz?
A: Lrzip first uses rzip to find very long-range duplicate data blocks (up to hundreds of megabytes apart), then compresses those blocks with lzma or another codec. This two-stage approach often shrinks large files—especially tar archives, disk images or log sets—far smaller than gzip or xz alone.

### Q: How do I install lrzip on Ubuntu?
A: sudo apt install lrzip. The same package name works in Debian, Fedora, Arch, openSUSE, FreeBSD ports, and via Homebrew on macOS.

### Q: Is lrzip safe for production backups?
A: Stable release 0.651 (March 2022) is widely packaged and considered production-ready. Being GPL-licensed, you can inspect, modify and redistribute it freely.

### Q: Can lrzip compress stdin/stdout?
A: Yes. Use lrzip -o - to write to stdout and lrzcat to decompress a stream, making it suitable for pipeline usage.

## Why It Matters
Disk space and transfer time still cost money. For archives that must be stored for years or shipped over slow links, every extra percentage point of compression saves real dollars. Lrzip delivers some of the highest ratios achievable with commodity hardware—often 20–50 % smaller than xz at comparable settings—because its rzip stage can spot duplicates that ordinary dictionary-based compressors miss. The payoff is immediate for system administrators who routinely tar /var/log, virtual-machine images or scientific datasets: smaller backups, faster uploads, lower cloud bills. Because lrzip is free software and already packaged everywhere, adopting it requires no license paperwork or proprietary tools; a single command switches tar’s compressor from gzip to lrzip. Finally, the project showcases how an individual developer—Con Kolivas, better known for Linux kernel scheduling work—can solve a practical problem, release it under a permissive license, and see it integrated into every major operating system within a decade.

## Notable For
- Achieves some of the highest open-source compression ratios by combining long-range redundancy detection with modern codecs.
- One of the few compressors that can efficiently handle multi-gigabyte tar files or disk images by finding duplicate blocks hundreds of megabytes apart.
- Maintained solely by Con Kolivas, an Australian physician and Linux kernel hacker, demonstrating a high-impact side project.
- Packaged in virtually every Linux/BSD distribution and available through Homebrew, making installation trivial on common platforms.
- Entirely GPL-2.0-or-later, ensuring permanent freedom to use, study and improve the code.

## Body
### Origin and Design
Con Kolivas created lrzip around 2008 as a personal experiment to extend the venerable rzip (by Andrew Tridgell) with pluggable codecs. By layering rzip’s long-range match finder on top of lzma, he obtained markedly better compression on large files while keeping decompression speed reasonable.

### Algorithm Walk-through
1. Long-range matching: rzip scans the entire file with a rolling hash, building an index of duplicate 32-byte chunks up to ~900 MB apart.  
2. Encoding: matched chunks are replaced by backward references; non-matched literals are passed to a second-stage compressor—lzma (default), lzma –fast, gzip, bzip2, or zpaq.  
3. Container: output is written in a simple proprietary format with magic bytes “LRZI”, followed by codec ID and compressed streams.

### Version History
- 0.600 series (2013) introduced multi-threading and lzma –fast mode.  
- 0.640 (2020) added zpaq backend for maximum ratio.  
- 0.650 (Feb 2022) fixed large-file bugs on 32-bit systems.  
- 0.651 (Mar 2022) is the current stable point release.

### Command Examples
Compress: lrzip -z big.tar          # -z = zpaq (slow, smallest)  
Decompress: lrzcat big.tar.lrz > big.tar  
Parallel: lrzip -p 8 -L 9 big.tar    # 8 threads, lzma level 9

### Integration
Debian’s tar supports –lrzip out of the box:  
tar –lrzip -cf archive.tar.lrz folder/

### Limitations
- Single-file compressor; users must tar first for multiple files.  
- Memory-hungry: rzip index plus lzma dictionary can require several gigabytes for large archives.  
- Decompression speed is tied to chosen backend; zpaq is extremely slow but yields the smallest files.

## References

1. [Release 0.650. 2022](https://github.com/ckolivas/lrzip/releases/tag/v0.650)
2. [Release 0.651. 2022](https://github.com/ckolivas/lrzip/releases/tag/v0.651)
3. [Source](https://metadata.ftp-master.debian.org/changelogs//main/l/lrzip/lrzip_0.641-1+deb11u1_copyright)