[CentOS] Can anyone suggest a decent backup system?
John R Pierce
pierce at hogranch.com
Thu Sep 16 20:10:05 UTC 2010
On 09/16/10 1:34 AM, Kevin Thorpe wrote:
> Can anyone suggest a simple backup package for us? Essentially a single
> server, full backup to tape every day. We don't need tape management as
> we're fully capable of reading the written label on the tape ourselves.
>
>
ummmm, reading your requirements again, and cogitating..... and...
tar
a simple script that tars each file system appending it to the same tape
(assuming your backup fits on one tape)....
maybe something like...
mt -f /dev/nst0 rewind
for fs in / /var /usr /home /opt /data ...; do
tar clf /dev/nst0 $fs
done
mt -f /dev/nst0 offline
If you do your backups this way, its important to keep track of the
order you write the file systems to the tape, as the tape position is
the only way to distinguish them
I'd probably add some logging to that script, and basic error
trapping. the following mess is totally untested and probably full of
errors. caveat emptor.
#!/bin/bash
d=${date -I}
lf=/var/log/mybackups-$d.log
df=/var/log/mybackups-$d.detail.log
dt=${date +"%Y-%m-%d %H:%M:%S%z"}
echo "$dt ******* Starting Daily Backup **********" >>$lf
mt -f /dev/nst0 rewind
for fs in / /var /usr /home /opt /data ...; do
echo "$dt Starting Backup $fs" >>$lf
tar clvf /dev/nst0 $fs 2>>$lf 1>>$df
if [ $? != 0 ]; then
{
echo "$dt Error in tar $fs. backups aborted" >>$lf
mail -s "***DAILY BACKUP ERROR****" user at mydomain.com < $lf
exit 1
} fi
echo "$dt Completed Backup $fs" >>$lf
done
echo "$dt Ejecting Tape" >>$lf
mt -f /dev/nst0 offline
echo "$dt ******* Daily Backup Complete **********" >>$lf
More information about the CentOS
mailing list