LZ4
From Just Solve the File Format Problem
				
								
				(Difference between revisions)
				
																
				
				
								
				 (Updated FormatInfo, updated links, added examples where lz4 is used under Linux and citations, added Wikipedia page.)  | 
			 (Added DWARFS as a user of LZ4.)  | 
			||
| Line 15: | Line 15: | ||
* [[SquashFS|<code>squashfs-tools</code>]]<ref>[https://github.com/plougher/squashfs-tools/blob/master/squashfs-tools/compressor.c#L31-L77 compressor.c (lines 31-77) - squashfs-tools - GitHub]</ref>  | * [[SquashFS|<code>squashfs-tools</code>]]<ref>[https://github.com/plougher/squashfs-tools/blob/master/squashfs-tools/compressor.c#L31-L77 compressor.c (lines 31-77) - squashfs-tools - GitHub]</ref>  | ||
* zram<ref>[https://docs.kernel.org/admin-guide/blockdev/zram.html#select-compression-algorithm 2) Select compression algorithm - zram: Compressed RAM-based block devices -- The Linux Kernel documentation]</ref> - Compressed RAM-based block devices.  | * zram<ref>[https://docs.kernel.org/admin-guide/blockdev/zram.html#select-compression-algorithm 2) Select compression algorithm - zram: Compressed RAM-based block devices -- The Linux Kernel documentation]</ref> - Compressed RAM-based block devices.  | ||
| + | * [[DWARFS]]<ref>[https://github.com/mhx/dwarfs/blob/main/src/compression/lz4.cpp lz4.cpp - DWARFS - GitHub]</ref>  | ||
== Identification ==  | == Identification ==  | ||
Revision as of 10:48, 16 August 2025
LZ4 is a lossless data compression algorithm and compressed data format. It is designed to support very fast compression.
In Linux, LZ4 appears as one of the many compression format for:
- vmlinuz[1]
 - initramfs[2][3][4]
 -  
squashfs-tools[5] - zram[6] - Compressed RAM-based block devices.
 - DWARFS[7]
 
Identification
When used as a file format, LZ4 files begin with signature bytes 04 22 4d 18.
There is also a legacy format, whose signature is 02 21 4c 18.
Resources
- LZ4 compression algorithm on Wikipedia
 - LZ4 website
 - LZ4 explained
 - How LZ4 works
 - Raising Lazarus - The 20 Year Old Bug that Went to Mars vs. Debunking the LZ4 "20 years old bug" myth
 
References
- ↑ extract-vmlinux shell script (line 56) - Linus Torvalds' kernel - GitHub
 - ↑ dracut.conf.5.adoc - dracut-ng manual pages - GitHub
 - ↑ mkinitcpio.conf (lines 61-67) - mkinitcpio - Arch Linux GitLab
 - ↑ manpage.md (line 57) - booster - GitHub
 - ↑ compressor.c (lines 31-77) - squashfs-tools - GitHub
 - ↑ 2) Select compression algorithm - zram: Compressed RAM-based block devices -- The Linux Kernel documentation
 - ↑ lz4.cpp - DWARFS - GitHub