[ Content | View menu ]

initial backup solution

Written on 12/31/2003

Nothing like the site of someone else’s mishap to focus attention on a problem.

The objectives of this are simple: back up the www directory on this machine in some easily usable form. I have a tape drive in this box, but tapes are not the easiest things to work with. So I elected to make a disk image that I can either burn to a CD or mount and inspect, as needed. The EXAMPLES section in the mkisofs man page gave me all the information I needed.

But I don’t necessarily want to burn a CD every time I back these files. So what I’ll do is create the image every night, copy to another system, thereby having two copies, the same as I could get if I burned to a CD but without the media cost.

#!/bin/sh
DATE=`date +%m-%d-%y`
cd /usr/local
/usr/local/bin/mkisofs -o /opt/backup/www-$DATE.iso -V backup-$DATE -R -J -hfs www
/sbin/mount_smbfs //me@backuphost/me /mnt/backuphost
cp /opt/backup/www-$DATE.iso /mnt/backuphost
cd /mnt/backuphost
cp www-$DATE.iso latest.iso
cd /opt/backup
/sbin/umount /mnt/backuphost
find /opt/backup -name "www*iso" -mtime +7 -print

Not too elegant, but I have tested it to make sure it creates mountable disk images and that’s what I’m after.

I’m going to take a leap of faith that I don’t lose a disk or the whole system on both systems I’m using for this. A logical extension of this would be to test that the mount operation (and the resulting copy) worked and substitute another place for the file to be stored.

Posted with ecto

Comments closed


My Amazon.com Wish List
Or buy yourself something from Amazon and we both benefit. Amazon Honor System payments work, too. Thanks!