Sunday, November 18, 2007

Orangutang - Backup Srategy - USB

WHAT
Black Box - Server Backup Only - $ sudo ./backup_to_server
Leecher - Server Backup Only - $ sudo ./backup_to_server
Orangutang - Server Backup - /usr/local/bin/exthddbak_server
Orangutang - Data Backup - Nightly to Black Box Nightly to USB HDD

Hardware
External 200GB HDD in Coolermaster Xcraft 300 case.


Server Backups

Purpose:
to backup the operating system drive so that I can restore it onto a new OS drive when this ancient peice of crap dies.

References - http://ubuntuforums.org/showthread.php?t=35087

Process - The basic process utilizes a shell script that calls TAR.

sgoggin@Orangutang:/usr/local/bin$ cat exthddbak_server
#!/bin/sh

date=`date "+%Y-%m-%dT%H:%M:%S"`
tar cvpjf /srv/extusbhdd/Orangutang$date.tar.bz2 --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys --exclude=/src --exclude=/srv --exclude=dev --exclude=/home / &

sgoggin@Orangutang:/usr/local/bin$

Data Backups

PURPOSE -
Take a regular backup of GOGGIN and store on USB drive. Incremental so that any changes to files are kept in case a virus roots them.

SCRIPT - Simple script using rsync

sgoggin@Orangutang:/usr/local/bin$ cat exthddbak_goggin_incremental
#!/bin/sh

date=`date "+%Y-%m-%dT%H:%M:%S"`
rsync -aP --link-dest=/srv/extusbhdd/Backups/current /srv/ActiveData/Goggin echo /srv/extusbhdd/Backups/back-$date
rm /srv/extusbhdd/Backups/current
ln -s back-$date /srv/extusbhdd/Backups/current
sgoggin@Orangutang:/usr/local/bin$
Disaster Recover

From - http://ubuntuforums.org/showthread.php?t=564836

Actual Test Run
sudo tar xvpfj "/srv/extusbhdd/BlackBox2007-11-22T20:44:22.tar.bz2" -C /srv/extusbhdd/test


My exact testing steps:
1. Freshly Installed 7.10 (Gusty-Gibbon-i386-desktop) on a Laptop.
2. Copied test data to system (600MB / 1,400 files) to both my home dir and desktop. And then installed KTron application (just a small-game to test if it works later).
3. Opened the Terminal and ran the following:
Code:
cd /
sudo tar cvpzf backup.tgz --exclude=/etc/fstab --exclude=/boot --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /
4. I then inserted a USB flash-drive & backed up the 'backup.tgz' and removed the drive.
5. As part of the test I intended to serverly damage the filesystem, so again, still at root on the terminal I ran the following to destroy the system:
Code:
sudo rm -fr *
6. Manually powered-off the system.
7. Powered on system and booted with the ubuntu-7.10 disc, and performed a new, fresh installation.
8. Once booted into my new installation I then inserted my USB flash-drive and proceeded to extract/restore my system/files back onto the system drive:
Code:
sudo tar xvpfz /media/USB-DRIVE/backup.tgz -C /
9. Restarted the system and all was restored fine. System & files restored and working.



No comments: