Borys Bradel's Blog

Backup Strategy Summary

Tags: backup, scripting May 6, 2009    

What is an effective backup strategy?

Since the answer I wrote is rather long, I will post a summary of the answer first. The summary contains the high and low level views of my solution, which although not perfect, is the only workable one I could find after searching for many years.

At the high level, backups require three essential components.

First, identify the data that needs to be saved.

Second, make backups once in a while.

Third, store the backups far away from the original data.

At the low level, the solution is to create a folder that contains all the material (which needs to fit on a cd/dvd if it is written to a cd/dvd, although this limitation can be overcome by spanning several cds/dvds) to backup (e.g. ~/b), write it out to cd/dvd and write a git repository of it to usb, and store these media in a safe place.

Sample commands for cd/dvd burning are

cd ~

mkisofs -r -iso-level=4 -m b/.git -o savedimg.iso b

dvdisaster -c -mRS02 -i savedimg.iso

/usr/bin/cdrecord speed=4 padsize=63s -pad -dao -v -eject -data savedimg.iso

Sample commands for cd/dvd reading, testing, and fixing are

dvdisaster -r -d/dev/cdrom -i image-new.iso

dvdisaster -t -i image-new.iso

dvdisaster -f -i image-new.iso

Sample commands for git repository creation are (assuming usb drive is connected)

cd /media/device

mkdir b

cd b

git --bare init

rm hooks/*

cd ~/b

git init

git remote add save1 /media/device/b (assuming usb drive is connected)

Sample commands for backing up to usb are

cd ~/b

git add .

git commit -m"auto backup"

git push save1 master

Sample commands for restoring to another system are (assuming usb drive is connected)

cd ~

git clone /media/device/b

Sample commands for undoing a deletion or change are (assuming usb drive is connected)

cd ~/b/whateve/dir/has/deleted/file

git checkout -- deleted.file

Copyright © 2009 Borys Bradel. All rights reserved. This post is only my possibly incorrect opinion.

Previous Next