lz4 compression algorithm

Overall LZ4 presentation –> http://lz4.github.io/lz4/

Get 7zip + LZ4 from https://github.com/mcmilk/7-Zip-zstd


Download the compression tool from http://fastcompression.blogspot.co.uk/p/lz4.html

Download tar tool and the dependencies

Extract tar  to D:\tools\tar

Extract the dependencies to D:\tools\tar

Extract lz.4exe to D:\tools\tar\bin

Use this command to compress all files inside c:/notes/data but Archive and Replicas folders:

tar -cv c:/notes/data  –exclude=Archive –exclude=Replicas | lz4 -9z > I:\Notes\notes-data-2016-07-22.tar.lz4

Use to uncompress the following:

lz4 -d i:\Notes\notes-data-2016-07-22.tar.lz4 | tar xvf –


@REM Script to compress a whole directory to a tar.lz4 archieve

if “%1″==”” goto showhelp
if “%2″==”” goto showhelp

if “%1″==”-c” goto compress
if “%1″==”-u” goto decompress

if “%3″==”” goto showhelp
:: Use to exclude any
::tar -cv %2 –exclude=Archive –exclude=Replicas | lz4 -9z > %3
tar -cv %2 | lz4 -9z > %3
goto :eof

lz4 -d %2 | tar xvf –
goto :eof

@echo To compress run:
@echo %~0 -c folder archieve.tar.lz4
@echo Example
@echo lz4tool.bat -c c:/notes/data I:\Notes\notes-data-2016-07-22.tar.lz4
@echo To decompress run:
@echo %~0 -u archieve.tar.lz4
@echo Example
@echo lz4tool.bat -u I:\Notes\notes-data-2016-07-22.tar.lz4




Older content is below:

This uses lz4.exe v1.4

Compressed filename will be : stdin.lz4
Incorrect parameters
Usage :
LZ4.exe [arg] [input] [output]

input : a filename
with no FILE, or when FILE is – or stdin, read standard input
Arguments :
-1 : Fast compression (default)
-9 : High compression
-d : decompression (default for .lz4 extension)
-z : force compression
-f : overwrite output without prompting
-h/-H : display help/long help and exit

d:\Downloads\Tools\lz4>LZ4.exe -9z “d:\VirtualBoxVMs\LPIC LiveCD\elpicx_20_20080925_EN.iso” “d:\VirtualBoxVMs\LPIC LiveCD\elpicx_20_20080925_EN.iso.lz4”
Read1483 MB (98.06%)
Compressed 1555345408 bytes into 1525113878 bytes ==> 98.06%

d:\Downloads\Tools\lz4>mkdir “d:\VirtualBoxVMs\LPIC LiveCD”\compress

d:\Downloads\Tools\lz4>move “d:\VirtualBoxVMs\LPIC LiveCD\elpicx_20_20080925_EN.iso.lz4” “d:\VirtualBoxVMs\LPIC LiveCD\compress”
1 file(s) moved.

d:\Downloads\Tools\lz4>LZ4.exe “d:\VirtualBoxVMs\LPIC LiveCD\compress\elpicx_20_20080925_EN.iso.lz4”
Decoding file d:\VirtualBoxVMs\LPIC LiveCD\compress\elpicx_20_20080925_EN.iso
Successfully decoded 1555345408 bytes

d:\Downloads\Tools\lz4>dir “d:\VirtualBoxVMs\LPIC LiveCD\compress”
Volume in drive D is Data
Volume Serial Number is B258-D576

Directory of d:\VirtualBoxVMs\LPIC LiveCD\compress

11/16/2015 12:31 PM <DIR> .
11/16/2015 12:31 PM <DIR> ..
11/16/2015 12:31 PM 1,555,345,408 elpicx_20_20080925_EN.iso
11/16/2015 12:29 PM 1,525,113,878 elpicx_20_20080925_EN.iso.lz4
2 File(s) 3,080,459,286 bytes
2 Dir(s) 17,921,728,512 bytes free


The following uses 1.2b

C:\Users\IBM_ADMIN>cd /d d:\Downloads\Tools\lz4

*** LZ4 v1.2b, by Yann Collet (Oct 21 2011) ***
Wrong parameters
Usage :
Drag’n’Drop interface : Drag a file onto the program to compress it.
Same for decompression.

Commandline interface :
LZ4.exe [arg] input [output]
Arguments :
-c# : force compression with # level (0,1,2)
-d : force decompression
-t# : use # threads (default = nb of cores)
-b# : benchmark mode with # compression level (using input files)
-s : silent mode (no stats animation)
-h : help (this text)
arguments can be appended (ex : -c2t1)
input : can be ‘stdin’ (pipe) or a filename
output : can be ‘stdout'(pipe) or a filename or ‘null’
— type any key to exit —

d:\Downloads\Tools\lz4>LZ4.exe-c2 “d:\VirtualBoxVMs\LPIC LiveCD\elpicx_20_20080925_EN.iso” “d:\VirtualBoxVMs\LPIC LiveCD\elpicx_20_20080925_EN.iso.tar.gz”
‘LZ4.exe-c2’ is not recognized as an internal or external command,
operable program or batch file.

d:\Downloads\Tools\lz4>LZ4.exe -c2 “d:\VirtualBoxVMs\LPIC LiveCD\elpicx_20_20080925_EN.iso” “d:\VirtualBoxVMs\LPIC LiveCD\elpicx_20_20080925_EN.iso.tar.gz”
*** LZ4 v1.2b, by Yann Collet (Oct 21 2011) ***
Detected : 4 cores
pb opening source file d:\VirtualBoxVMs\LPIC LiveCD\elpicx_20_20080925_EN.iso

d:\Downloads\Tools\lz4>LZ4.exe -c2 “d:\VirtualBoxVMs\LPIC LiveCD\elpicx_20_20080925_EN.iso” “d:\VirtualBoxVMs\LPIC LiveCD\elpicx_20_20080925_EN.iso.tar.gz”
*** LZ4 v1.2b, by Yann Collet (Oct 21 2011) ***
Detected : 4 cores
Compressing d:\VirtualBoxVMs\LPIC LiveCD\elpicx_20_20080925_EN.iso using 4 threads (compression level = 2)
Compression completed : 1483.3MB –> 1455.1MB (98.10%) (1525788153 Bytes)
Total Time : 30.78s ==> 50.5MB/s
(CPU : 44.43s = 144%)

d:\Downloads\Tools\lz4>LZ4.exe -d “d:\VirtualBoxVMs\LPIC LiveCD\compress\elpicx_20_20080925_EN.iso.lz4”
*** LZ4 v1.2b, by Yann Collet (Oct 21 2011) ***
Decoded Filename is : d:\VirtualBoxVMs\LPIC LiveCD\compress\elpicx_20_20080925_EN.iso
Detected : 4 cores
Decoding into d:\VirtualBoxVMs\LPIC LiveCD\compress\elpicx_20_20080925_EN.iso using 1 threads…
Regenerated size : 1555345408 Bytes
Total Time : 1.20s ==> 1293MB/s
(CPU : 0.23s = 19%)


This entry was posted in tools and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s