Backing up to CD
noeld@rootprompt.org
A CD-R(W) is an inexpensive device, with inexpensive media. The one I
have was purchased for $135 and I have media that I payed about 33
cents a piece for. A CD-R holds enough information for my personal needs
and it is stable compared to magnetic media. I have chosen to use
CD-Rs rather than CD-RW because of the additional cost of CD-RWs.
CD-Rs would not be big enough for a backup device in most production
shops as it does not hold a great deal of data. Leaving some room for
overhead on a Joliet CD you can expect about 620MB of data to fit.
This is plenty of room for my home directory and the most
important system files, but if you had hundreds of Gigabytes to
backup you would need a tall stack of CD-Rs.
If you had too much data to fit on one CD you could break up your backup
job into several different CD-Rs. Backup your system on Monday, your
MPEGS on Tuesday, your email on Wednesday, etc.
One additional concern is that the cheap CD-Rs may not last as long as
the more expensive ones. What I plan to do is use a more expensive
CD-R occasionally so that even if the cheap ones fail or only last a
year I will still have a backup. Each brand of CD-R uses different
chemical compounds for the CD for patent reasons so I would recommend
that you use different brands for your backup. That way if one brand
degrades faster than it should you will still have your backups.
I am not going to go over setting up your CD-R drive. For help on
doing that take a look at the CD Writing HOWTO. I will touch on the
command line utility we are going to use to burn the CD-R.
If all you have used is the GUI tools such as cdrtoaster then you may
not know the device parameter for cdrecord. You can find this value
by using 'cdrecord -scanbus'.
# cdrecord -scanbus
Cdrecord 1.8 (i686-pc-linux-gnu) Copyright (C) 1995-2000 Jorg Schilling
Using libscg version 'schily-0.1'
scsibus0:
0,0,0 0) 'IOMEGA ' 'ZIP 100 ' '23.D' Removable Disk
0,1,0 1) 'MITSUMI ' 'CR-4804TE ' '2.8C' Removable CD-ROM
0,2,0 2) *
0,3,0 3) *
0,4,0 4) *
0,5,0 5) *
0,6,0 6) *
0,7,0 7) *
#
The device parameter would be "0,1,0".
The basic steps for this backup are:
- Collect what we want on the CD-R.
- Create an image of the CD-R on the hard disk
- Burn the image onto the CD-R
A simple backup script:
BackupCD.sh
#!/bin/sh
cd /
# Set a couple of values
DATE=`/bin/date +%b-%d-%y`
HOST=`hostname`
echo "Starting Backup"
/bin/date
date >/work/backup/$HOST-$DATE
# Tar the system stuff and place a list on the CD-R
tar -czvf /work/backup/system.tgz \
./etc \
./usr/local/bin \
>/work/backup/system.txt
echo "Building CD Image"
/bin/date
mkisofs -r -f -o /work/cdroms/backup.iso \
/home \
/work/backup/system.tgz \
/work/backup/$HOST-$DATE \
/work/backup/system.txt
echo "Burning CD"
/bin/date
cdrecord -v speed=2 dev=0,1,0 -data /work/cdroms/backup.iso
rm /work/backup/system.*
echo "Done"
/bin/date
eject cdrom
Using a CD-RW to backup your system can be an economical method as
long as the data you need to backup will fit on a CD-R or you are
willing to break the backup into CD-R sized chunks.
|