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

Re: System Backup to CD

On Fri, Jun 22, 2001 at 05:44:10PM -0500, Thomas H. George wrote:
> Though I kept good notes, it took much effort to restore my current 
> debian linux system with all the apt-get's and other downloads after a 
> hard disk crash wiped out everything.  With Windows I always had to be 
> prepared for system crashes and regularly used DriveImage to copy my 
> complete C-drive with boot sector and my complete D-drive (all my data 
> files) to CD's.  In the early versions it was necessary to copy these 
> drives to .pqi files on other hard drives and then use CDWriter to copy 
> the .pqi files to CD's.  The last version of DriveImage that I purchased 
> could write directly to CD's.  Either way, when Windows crashed - as it 
> often did - I had only to boot to the DriveImage DOS disks and restore 
> the C and D drives from the CD's.  It didn't take more than 20 minutes 
> to get up and running again.

Unix has always had a "driveimage" (before it had traceroute, even).
We prefer to call it "dd", because that's less typing.

  dd if=/dev/hda of=/dev/hdc bs=512

Copies all of disk hda onto disk hdc.  If you take a note of how many
blocks were read and written (dd prints it when it's finished), say it
$blocks, then you can restore hda exactly by:

  dd if=/dev/hdc of=/dev/hda bs=512 count=$count

Backup the master boot record on /dev/hdb to a file:

  dd if=/dev/hdb of=/tmp/mbr.bin bs=512 count=1

Of course, there's cat.  In unix, there's nearly always some twisted 
way to do it with cat instead.

  cat /dev/hda > /mnt/nfs/backups/clients/foohost/raw/hda

Presto: a networked backup system, in one line.  And restore is easy too:

  cat /mnt/nfs/backups/bla > /dev/hda

Unfortunately it works a little different with cdrw's so I'll touch on
that only lightly.  You should to create a iso9660 filesystem containing
the backed up files and then burn that filesystem image (like the .pqi).
Note that "should", it is not a law.  You can write ext2fs to a cdrom
fine too, even arbitrary flat data streams probably.  Most of the world
just wouldn't know how to make sens of the data though.  Your windows
might even catch a blue screen from it.

It can be done fine without any intermediate file store, just use a
traditional unix pipe.

  mkisofs -o - files_to_backup | cdrecord -dev 0,0,1 -

Maybe (likely) you need to tweak the options a bit here and there.  
When you have attained perfection, put it in a script and perhaps
put it in crontab.  Also put someone in crontab to change the cd's
once in a while.  :-)

> Still, Debian Linux is so elegant there is very likely a better way.  If 
> so, I haven't found it yet.  If I have missed something obvious, please 
> point me in the right direction.

Well the above is really the simple way.  You can do it the complicated
way too.  People have been doing that on unix for close to 30 years.

We've discussed cat and dd, figure the dump(1) and restore(1) manpages for
yourself.  And where do you think tar(1) originates from?  Starting from
there, there's a whole range of "solutions", from your diy hack script,
up to "enterprise-wide" backup systems that generate billions of turnover
every year.  And there's amanda, which is free.  And in debian.



Reply to: