[prev in list] [next in list] [prev in thread] [next in thread] 

List:       suse-linux-uk-schools
Subject:    Re: [suse-linux-uk-schools] Script for Over Night Backup
From:       Christopher Dawkins <cchd () felsted ! essex ! sch ! uk>
Date:       2001-05-21 11:18:46
[Download RAW message or body]


> Would that person (Sorry I have had to delete the mail to keep my mailbox
> size down), mind mailing the script, as it would be an invaluable thing to
> see. I could just copy and paste the user information, but the script would
> be good.

We use rsh: the remote machine needs the calling machine to be in its
/root/.rhosts (or maybe in /etc/hosts.equiv). With this script the gzip is
run locally. It needs a fast processor: it can instead be run before
the pipe so it runs on the remote machine, depends on where you want your
network/processor bandwidth consumed. The calling machine needs a large
hard drive. The two scripts I use are

cd /usr/local/etc/dumpscripts
dev253# cat dump0.sh
#!/bin/sh
# file dump0  parameters are server id then partition
# copies old level 0 dump then creates new one
umask 066
if [ $2 = "/" ]; then fsname=root; else fsname=${2#/}; fi
filename=/backup/${1}/${fsname}-0.gz
filename2=/backup/${1}/${fsname}-0-bak.gz
if [ -r ${filename2} ]; then rm ${filename2} ; fi
if [ -r ${filename} ]; then mv ${filename} ${filename2} ; fi
rsh ${1} /sbin/dump 0abfu 32 - $2 | gzip >${filename}

and
dev253# cat dumpw.sh
#!/bin/sh
# file dumpw  parameters are server id then partition
# dump level 1 every time in this version
# won't do level 0 dumps
umask 066
day=`date +\%u`
if [ $2 = "/" ]; then fsname=root; else fsname=${2#/}; fi
filename=`date +/backup/${1}/${fsname}-1-\%a.gz`
rsh ${1} /sbin/dump 1abfu 32 - $2 | gzip >${filename}
dev253#

and some crontab entries are

15     0       *       *       1       root
  /usr/local/etc/dumpscripts/dump0.sh
  serv254 u 2>&1 | sendmail cchd@felsted.essex.sch.uk
15     1       *       *       2-7     root
  /usr/local/etc/dumpscripts/dumpw.sh
  serv254 u 2>&1 | sendmail cchd@felsted.essex.sch.uk

this resulting in a directory containing

drwxr-xr-x  4 root  wheel         512 May 13 23:00 ..
-rw-------  1 root  wheel  7233205487 May 14 12:00 u-0-bak.gz
-rw-------  1 root  wheel   217554866 May 15 03:02 u-1-Tue.gz
-rw-------  1 root  wheel   232839231 May 16 03:03 u-1-Wed.gz
-rw-------  1 root  wheel   241696540 May 17 03:04 u-1-Thu.gz
-rw-------  1 root  wheel   245983202 May 18 03:04 u-1-Fri.gz
-rw-------  1 root  wheel   253113006 May 19 03:04 u-1-Sat.gz
-rw-------  1 root  wheel   247110325 May 20 03:05 u-1-Sun.gz
drwxr-xr-x  2 root  wheel         512 May 21 02:45 .
-rw-------  1 root  wheel  7245933740 May 21 09:09 u-0.gz
dev253#

and recovery is done with a command like

 # zcat u-0.gz | restore -if -

If you are short of space you can instead dump level 1 on Monday, level 2
on Tuesday, level 3 on Wednesday etc. If you are very mathematical you can
do a towers-of-hanoi rotation. If you have plenty of space you can keep
more than a fortnight and if you are cautious you can back up the dumped
files to tape (you will find they don't compress so a 20/40 HP DAT drive
will only take 20GB of dumps).

But with this system you can back up several systems concurrently. You
just need to buy lots of big slow hard drives, put them on spare
machines around the campus and devise a schedule.

-- 
Christopher Dawkins, Felsted School, Dunmow, Essex  CM6 3JG
01371-820527 or 07798 636725           cchd@felsted.essex.sch.uk



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic