Praznje marnje.

ponedeljek, maj 14, 2018

7z differential archive/backup

With use of the -u switch one can create differential archive file.

To Create Differential Archive File

1. full archive

This creates base for tracking file change.

7za a archive.7z  path_to_folder  -ms=off -mx=9 -t7z

2. differential archive

This will write updates to diffarch.7z. Original archive.7z will not be changed.
7z does not issues warning if full archive does not exist when running differential. The differential holds all files (it behaves as 'a' command).

7za u archive.7z  path_to_folder  -ms=off -mx=9 -t7z -u- -up0q3r2x2y2z0w2!diffarch.7z

This will update original archive.7z.

7za u archive.7z  path_to_folder  -ms=off -mx=9 -t7z -up0q3r2x2y2z0w2


To Restore From Differential File

1. full archive

7za x archive.7z -oc:\recovery_path\

2. last differential archive

7za x diffarch.7z -aoa -y -oc:\recovery_path\


Explanation

Make sure to disable solid mode -ms=off as, according to 7z manual, "the updating of solid 7z archives can be slow, since it can require some recompression". Other switches are for compression rate, archive format, overwrite all existing files without prompt, and confirm all questions. Some features are supported by 7z format only.

-u switch

The letters:

p – File exists in archive, but is not matched with wildcard.
q – File exists in archive, but doesn't exist on disk.
r – File doesn't exist in archive, but exists on disk.
x – File in archive is newer than the file on disk.
y – File in archive is older than the file on disk.
z – File in archive is same as the file on disk
w – Can not be detected what file is newer (times are the same, sizes are different)


The numbers:

0-  Ignore file (don't create item in new archive for this file)
1 - Copy file (copy from old archive to new)
2 - Compress (compress file from disk to new archive)
3-  Create Anti-item (item that will delete file or directory during extracting). This feature is supported only in 7z format.

7za

7za / 7za.exe  - is contained in extra download:  7z<version>-extra.7z

Caveat

Do NOT use the 7z, gz, or zip for system backup purposes, because those programs do not store the owner/group of the files.

On Linux/Unix use tar for backup.

To backup a directory
tar cf – directory | 7za a -si directory.tar.7z

To restore your backup :
7za x -so directory.tar.7z | tar

Original two blogs

Ni komentarjev: