RIP Dennis Ritchie

One of the fathers of Unix and the C programming language has sadly passed away today. Farewell to a man who has influenced computing in an unbelievable manner. dmr, you are one of the greatest computer scientists of all time.

Published 13/10/2011 at 09:03

Multi-volume, incremental backups using GNU tar

As I can never seem to remember the commands used for creating a multi-volume tarball with incremental backups, I'm posting this here to remind myself.

The following command creates an archive that spans multiple disks, and creates a .snar snapshot file for incremental backups.

gtar -M -L length[suffix] -g /path/to/snapshot.snar -cvf /path/to/destination.tar /path/to/directory

It would be wise to specify a length that is smaller than the destination as we don't want to fill up the destination backup device to the last byte. The snapshot file can be stored anywhere, as long as it can be accessed when the next incremental backup is performed. For example:

gtar -M -L 1385770M -g /pool0/tapes/home.snar -cvf /media/backup/home.1.part01.tar /home

Will begin creating an archive of the home directory on your backup media with the name home.1.part01.tar. Once the volume size has reached 1385770 megabytes (roughly the size of a 1.5TB disk), tar will prompt you for the next file. Swap media and specify the name of the next volume by entering:

n /new/path/to/home.1.part02.tar

And continue the backup. Happy backups, and remember that "doing nothing", while a valid backup solution - will not guarantee the safety of your data.

UPDATE: due to a lack of functionality on the part of GNU tar, the prompt does not allow you to enter a new path into the prompt. Thus when specifying "n newtarname.tar", it will proceed to create the new volume in the present working directory. A bit silly, but the problem can be avoided by starting tar inside the directory where you want to create tarballs. For example, cd into /media/backup and run tar there. When the media is full, unmount the media, mount the new one and then you may continue.

Published 03/10/2011 at 13:53

RSS