Thursday, June 11, 2009

Playing With Dar

I'm playing with backups again. Most recently, I'm looking at dar. Some quick notes:

To backup just /etc, become root, make sure your pwd is /, and type this:

dar -v -c /path/to/etc-backup -g etc
This will create a file named etc-backup1.dar at the path you specified. The -v is optional. To do the same but encrypt the archive do this:
dar -K passphrase -v -c /path/to/etc-backup -g etc
Where "passphrase" is your sneaky passphrase. To list the contents of the archive:
dar -K passphrase -l /path/to/etc-backup
Of course, you leave out the -K passphrase if you didn't encrypt it in the first place. Notice that you don't give it the full filename, ever. Getting more advance, to write the backup to a file on a remote machine over ssh, do this:
dar -c - -g etc | ssh user@host dd of=/path/to/etc-backup.1.dar
You tell dar that the backup file is stdout, pipe that to ssh, and use dd on the remote side to put the backup into the file. Note that you need to give the resulting file a proper dar filename since you don't have dar on the remote side doing it for you. Not a bad little tool.

No comments: