Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

7zip Fastest LZMA2 compression

How can I convert these settings into a command?

Screenshot of the options on archive creation

Archiv format:7z
compression level: Fastest
Compression method: LZMA2
Dictionary size: 64kb
Word size: 32
Solid Block size: 8MB
Number of CPU threads: 30

I tried this:

"7z.exe" a -t7z "F:\BACKUP" "D:\Source" -m0=LZMA2:d=64k

The compression is good but it takes three hours, instead of 1 hour when using the GUI. I looked at the documentation but I couldn't figured it out.

like image 737
Paul Smith Avatar asked Oct 07 '16 09:10

Paul Smith


1 Answers

This question would be better asked on Super User than on Stack Overflow as it is not about programming, just about how to use a command line tool with the correct options for a task.

7-Zip comes with the help file 7-zip.chm which can be opened with a double click. On help tab Contents there is the list item Command Line Version. The first help page to read for usage of 7-Zip from command line is Command Line Syntax displaying at top

7z <command> [<switch>...] <base_archive_name> [<arguments>...]

So it should be clear from this line that all the switches should be specified between the character for the command and the archive file name. Switches are supported also later on command line, but it should be nevertheless avoided to specify switches right of archive file name.

The help page -m (Set compression Method) switch is indeed not really easy to understand. There are some examples at bottom of this help page, but the syntax is nevertheless not explained very clear.

I think the command line to use with the wanted options is:

"7z.exe" a -t7z -m0=LZMA2:d64k:fb32 -ms=8m -mmt=30 -mx=1 -- "F:\BACKUP" "D:\Source"

a is the command Add.

-t7z sets the archive type to 7-Zip.

-m0=LZMA2:d64k:fb32 defines the usage of LZMA2 compression method with a dictionary size of 64 KB and a word size (fast bytes) of 32.

-ms=8m enables solid mode with a solid block size of 8 MB.

-mmt=30 enables multi-threading mode with up to 30 threads.

-mx=1 selects fastest compressing as level of compression.

-- stops parsing for other switches on rest of the command line.

like image 126
Mofi Avatar answered Oct 11 '22 13:10

Mofi