Re: backup strategies
Jeroen Valcke <jeroen@valcke.com> writes:
> After the not so pleasant adventures of last night (see my previous mail
> "unattached inode") I started realizing that instead of my root fs the
> problems could have occured on my home partition, destroying valuable
> data. I must admit I don't make backups on a regular basis. Now and then I
> copy some important files to another (win) pc on my home LAN.
> So I need better backup. What do you use?
> What kind of media? Tape, CD, second hd, ...
> How to backup? one full backup every month, incremental every week?
> The cd solution probably has an advantage, since I could use the cd-writer
> for other cd-writing too.
I have an old SCSI 4G drive which I use for backup only. The fs is
mounted ro (except while backing up) all the time, so in case it
should be fine.
Backups are done nightly on an incremental basis, I found this script
very useful:
------------snip-------------
#!/bin/sh
# full and incr backup script
# created 27 Sep 99
# Based on a script by Daniel O'Callaghan <danny@freebsd.org>
#Change the 5 variables below to fit your computer/backup
COMPUTER=<hostname> # name of this computer
DIRECTORIES="/etc /home /mnt/bigpart/usr/local/etc /var/lib /var/state" # directories to backup
BACKUPDIR=/backups # where to store the backups
TIMEDIR=/backups/last-full # where to store time of full backup
TAR=/bin/tar # name and locaction of tar
#You should not have to change anything below here
SRC_CONF=/usr/src/linux/.config
PATH=/usr/local/bin:/usr/bin:/bin
DOW=`date +%a` # Day of the week e.g. Mon
DOM=`date +%d` # Date of the Month e.g. 27
DM=`date +%d%b` # Date and Month e.g. 27Sep
# On the 1st of the month a permanet full backup is made
# Every Sunday a full backup is made - overwriting last Sundays backup
# The rest of the time an incremental backup is made. Each incremental
# backup overwrites last weeks incremental backup of the same name.
#
# if NEWER = "", then tar backs up all files in the directories
# otherwise it backs up files newer than the NEWER date. NEWER
# gets it date from the file written every Sunday.
mount -o remount,rw /backups
if [ $DOM = "01" ]; then # monthly full backup
NEWER=""
$TAR $NEWER -z -c -f $BACKUPDIR/$COMPUTER-$DM.tgz $DIRECTORIES $SRC_CONF
fi
if [ $DOW = "Sun" ]; then # weekly full backup
NEWER=""
NOW=`date +%d-%b`
echo $NOW > $TIMEDIR/$COMPUTER-full-date #update full backup date
$TAR $NEWER -z -c -f $BACKUPDIR/$COMPUTER-$DOW.tgz $DIRECTORIES $SRC_CONF
else #make incremental backup - overwrite last weeks
NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`" #get date of last full backup
$TAR $NEWER -z -c -f $BACKUPDIR/$COMPUTER-$DOW.tgz $DIRECTORIES $SRC_CONF
fi
mount -o remount,ro /backups
-------------snap------------
--
Tschoe, Get my gpg-public-key here
Jens http://gecius.de/gpg-key.txt
Reply to: