Differential Backups with 7-zip
In addition to creating simple compressed archives, 7-zip can also do
which can save a good amount of space when updating large archives.
It basically works like this:
1. You backup, for example, a folder to a 7z archive.
2. Later on—after files in the folder have been added/changed/removed—you create an additional archive, which only contains the changes made since the initial backup.
Note: due to a limitation of 7-zip (for now) the differential or "update" mode does not work with split archives.
Let's see how it's done, by exploring two different methods.
1. The easy way (GUI with Toucan)
The easiest way is by using a program called
You can either do the whole backup with Toucan from the start or you can take an existing 7z file and create just the differential in Toucan. Both produce the same result in the end, but if you made the first 7z file without Toucan just remember this: Toucan looks for a file with the name BaseFile.7z in the destination folder (aka Backup Location).
If a file with such a name exists then Toucan will make a differential 7z (with the current date and time as its name). If it doesn't exist, Toucan will assume you're doing a backup from the start and it will create a BaseFile.7z.
Here's an example of how the Toucan Backup window should look like:
Make sure the type and format are set to Differential and 7-zip,
respectively. From Computer you add the Files to Backup with the plus
sign and Backup Location is where both the initial and the differential 7z
files will be.
After a successful differential backup, you should end up with two files in your backup folder, like this:
2. The leet hacker way (CLI)
If you prefer using the command line there's that too and it has some additional settings.
An example syntax for creating a differential archive looks like this (assuming you already made a base archive):
7z u stands for update mode, -u- tells not to modify the existing
archive and then there's the long string of commands, which essentially tells what
to do with existing files in the archive and in the source folder (ignore the same files,
overwrite the older ones with newer, mark the missing ones for deletion etc.).
There are many other switches and options, you can find references for them here and for the update command specifically here. Example command:
If the base file is encrypted you'll be asked for the password during the process. But you can also add it with the -p command.
3. Extracting differential backups
When you have the base 7z file and the differential 7z file, you can extract them
to recreate the latest version of the archived folder.
First extract the base file and then extract the differential file to the same location. You can do this through the 7-zip context menu. You might be prompted to overwrite older files/folders and also files/folders that have been deleted since the initial backup. The latter are actually "anti-items" with the same name and extracting them will result in those files or folders being deleted.