Simply Backup help

daniel sobey dns_server at yahoo.com
Tue Mar 31 02:24:17 BST 2009


When thinking about backups you need to ask yourself what you are protecting against.

Do you want to protect yourself against a hard drive failure?
Though not a backup raid mirroring can help reduce the effects of this.
you could do a copy of all the data on one disk to another disk in the same machine.

do you want to protect against theft or fire?
You can rsync your files to a remote machine.
you can backup to a tape or an external hard drive and leave a copy at home, at your parents house etc.

do you have databases?
you will need to run a database tool to create a backup or do an export of the tables first. an os copy of the data files would not work as the  database may be writing the file during the copy and you would get an inconsistent copy.

do you need protection against file corruption?
some backup methods only keep one version of the file, if you make a mistake and create a bad version of the file you may not have a copy to go back to so make multiple backups or use a system that supports versioning.

how frequent do you need to back up? what type of machine is it?
I would probably have 2 types of backups, a full system backup and a backup of some of the things that frequently changes.
The full backup would just start on your / and move forward. some advanced systems will do a lvm snapshot to ensure you get a consistant backup from the time the snapshot was taken. I would do this atleast once a week, maybe daily maybe once a month it depends on your needs.

For the daily frequent backup i would backup just the important information to you. It may just be your home directory for your pc maybe your /etc as well. if you run a web server bakup your /var/www, if you have a database, do an export and backup the backup files.

I have a vm at work, i do a daily tar backup of my /home and a weekly tar on my /.
if you are working on a project a versioning system would be a good idea to keep track of changes and allow you to go back to a previous change.


here is my script: 
#!/bin/bash
BACKUPDIR=/media/cifs/dns/backups
BACKUPFILE=$BACKUPDIR/ubuntu-full-`date +%Y%m%d`.tar.gz
LOGFILE=$BACKUPDIR/ubuntu-full-`date +%Y%m%d`.log
BACKUP_RETENTION=+14

dpkg --get-selections >/home/dns/installed-packages

echo "beginning backup at `date`" >$LOGFILE
tar --exclude=media/* --exclude=proc/* --exclude=storage/* --exclude=dev/* --exclude=sys/  --exclude=lost+found/*  --exclude=mnt/* -czvf $BACKUPFILE / >> $LOGFILE 2> /dev/null
echo "finished backup at `date`" >> $LOGFILE





More information about the ubuntu-au mailing list