[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[backup method] tar or dump for backups? (Summary)



I posted about this and received no replies.  I thought I'd report back
about what I wound up doing... 

> I have a spare 1 GB disk at work which I could use to backup my /home
> partition (which consists of 1 GB amidst a 4.3 GB disk). 
> 
> (If I decide I can tolerate the 1GB-disk's whining; it's surprising how
> annoying the sound of the old disk is compared to my new Seagate 
> Barracuda.)

I'm using scsi-idle to spin the disk down when not needed, so I don't
hear it at all since the backups run at night! 
 
> I'm accustomed to using tar.  I thought I'd learn about incremental tar
> archives and:
> 
>  o  erase the disk every Friday evening and make a new tar file
>     on the disk.
>  o  create an incremental tar file from Monday to Thursday evenings.
> 
> Is this wise?  Or should I use dump/restore which I know nothing about?

I decided to go with a known quantity and use tar.

> Part of the protection I want is from myself:  
>  If I accidentally delete a file on Monday and it takes me until 
>  Thursday to realise that, I'd like the file to still exist on the backup.

I added a few /etc/crontab entries to run at 2 AM:

00 2    * * 6   root    /root/backup-weekly
00 2    * * 2   root    /root/backup-weekdays 1-tuesday
00 2    * * 3   root    /root/backup-weekdays 2-wednesday
00 2    * * 4   root    /root/backup-weekdays 3-thurday
00 2    * * 5   root    /root/backup-weekdays 4-friday

and created simple scripts that run at night and email me results:
/root/backup-weekly:

#! /bin/sh
# Weekly backup
mount -t ext2 /dev/sdb2 /backup
rm -f /backup/weekly/*
/usr/bin/dpkg --get-selections > /backup/weekly/debian.selections
tar -c -f /backup/weekly/etc.tar /etc  1> /dev/null 2> /dev/null
tar -c -f /backup/weekly/root.tar /root  1> /dev/null 2> /dev/null
tar -c -f /backup/weekly/home.tar -g /backup/weekly/home.snapshot /home/  1> /dev/null 2> /dev/null
df /dev/sdb2 | mail rhogee
umount /backup

/root/backup-weekdays:

#! /bin/sh
# Weekday backup job -- Monday -> Thurdsy
# Usage:  backup-weekday 1-monday
#
mount -t ext2 /dev/sdb2 /backup
tar -cvf /backup/weekly/home-$1.tar -g /backup/weekly/home.snapshot /home/  1> /tmp/backup-log 2> /tmp/backup-errors
if ( test -f /tmp/backup-log ) then
     mail -s "backup log -- `date`" rhogee < /tmp/backup-log
else
     echo "No backup log file!" | mail rhogee
fi;
if ( test -f /tmp/backup-errors ) then
     mail -s "backup errors ! -- `date`" rhogee < /tmp/backup-errors
fi;
df /dev/sdb2 | mail rhogee
umount /backup

My backup partition looks like this today:

bash-2.00# ls -l /backup/weekly/
total 576964
-rw-r--r--   1 root     root         6210 Aug  9 02:00 debian.selections
-rw-r--r--   1 root     root      1832960 Aug  9 02:00 etc.tar
-rw-r--r--   1 root     root      9134080 Aug 12 02:01 home-1-tuesday.tar
-rw-r--r--   1 root     root        47842 Aug 12 02:01 home.snapshot
-rw-r--r--   1 root     root     575283200 Aug  9 02:06 home.tar
-rw-r--r--   1 root     root      2191360 Aug  9 02:00 root.tar

Pretty cool!
--
Peter Galbraith, research scientist             <galbraith@mixing.qc.dfo.ca>
Maurice-Lamontagne Institute, Department of Fisheries and Oceans Canada
P.O. Box 1000, Mont-Joli Qc, G5H 3Z4 Canada  418-775-0852 - FAX 418-775-0546


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: