Need Suggestions for Automated Backup

Ian Stephen ianstepn
Mon May 17 11:56:19 PDT 2004


On Mon, 2003-12-01 at 18:39, Chong Yu Meng wrote:
> <snip> I was wondering how 
> good CD-ROM backups are. I haven't heard of anyone using it, and I'm 
> wondering if it is because they are unreliable. I'm thinking of the 
> following scheme:
> 
> 1. Tar all files to be archived into a humongous file
> 2. Mount CDROM drive (with blank CD inside)
> 3. Copy humongous tar file to CD
> 4. Unmount CD
> 
> All operations are to take place possibly around 4am local time.

I read somewhere recently that CDs may not give reliable backup for as
long as previously thought.  It was still in terms of years though. 
Sorry this is so vague, I didn't pay any attention when I read it.

I'm just a simple home/soho user, but after some questions to this list
I put together a bash script for backups.  Comments/flames welcome.

Starts by deleting files left behind by the last run then goes;

# have it check the size to be backed up
du -c `cat ./Backups/backuplist.txt` > ./Backups/backupsize.txt

# get just the total size
tail -n1 ./Backups/backupsize.txt > ./Backups/backuptotal.txt

# read that total size into variables for comparison
read <./Backups/backuptotal.txt fullsize extraword

# compare fullsize of backup to my maximum and quit if too big
if test $fullsize -gt 800000
       then echo "Oh crap it's too big! " $fullsize "bytes!"
            exit
fi

# With old files safely out of the way and size checked
# have find make a TOC for my backup based on
# what directories I've put in backuplist.txt

find `cat ./Backups/backuplist.txt` >> ./Backups/found.txt;

# cpio uses find's TOC to create an archive named backup.cpio
# in the Backups directory

cpio -oavBH crc < ./Backups/found.txt > ./Backups/backup.cpio;

# bzip2 compresses backup.cpio

bzip2 ./Backups/backup.cpio

# make an iso from the bz2 file

mkisofs -r -o ./Backups/backup.iso ./Backups/backup.cpio.bz2

# change permissions of the iso so cdrecord can burn it

chmod 666 ./Backups/backup.iso

# burn the compressed archive to CD

cdrecord speed=4 dev=0,0,0 ./Backups/backup.iso



More information about the Linux-users mailing list