Using 7-zip for Backups

7-zip is an open source alternative to PKZip for file compression. Like PKZip, it is also an excellent backup tool. You can use it to back up your entire system, or just the important portions to an external USB drive. Among 7-zip's good points:

On the down side, 7-zip doesn't support doing incremental backups (backups of only the files that have changed since the last backup). I never use this feature, so 7-zip is fine for me. If you need to do incremental backups, check out Using PKZip for Backups.


7-zip is designed for compression, not speed, so getting 7-zip to go as fast as pkzip is a bit tricky. Fortunately, I've figured it out so you don't have to. Here are the results of my benchmark tests:

Program and Options Time Size (bytes)
7-zip 4.65 -tzip -mx=1 -mtc=on 02:31:23   22,467,220,410
7-zip 4.65 -tzip -mx=3 -mtc=on 02:31:23 22,467,220,497
pkzip 5.00 -max 02:35:28 22,429,984,213
7-zip 4.65 -tzip -mx=5 -mtc=on 03:14:42 22,375,457,975
7-zip 4.65 (native) -mx=1 -ms=off -mf=off   06:05:15 22,285,693,969

From this it's apparent that 7-zip is fastest when making a "zip" archive. So, if you're low on CPU power, a zip archive is best. 7-zip's native ".7z" format requires more CPU power, but does yield smaller files. I recommend doing your own benchmarks to determine how long you are willing to wait for your backup.

7-zip has many options to control its compression algorithms. If you decide that you want speed rather than compression, .zip format is the way to go. The following options are useful when working with .zip format:

7-zip's native ".7z" format offers slightly higher compression, but tends to require a lot of CPU. The following options are useful when working with .7z format:

Batch File

Here's the centerpiece of my backup batch file:

cd \
7za a -tzip -mx=1 -mtc=on -v732954624 -r -x@c:\system\bm7za.exc %1 @c:\system\

The includes file ( looks like this:

documents and settings\*

It is important to note that in order for the full path to be stored in the 7zip archive, the includes entries must start with a directory name (so c:\system\* and \system\* will not work). This means that your batch file must switch to the appropriate drive and directory for your includes file to work properly.

The excludes file looks like this:

Temporary Internet Files
*\Local Settings\Temp


Restoring with 7-zip requires nothing other than an "x" for extract:

7za x

If you want to restore a specific directory:

7za x "documents and settings\all users\*"

<- Back to my Technology page

Copyright ©2009, Ted Felix