-   Linux - Newbie (
-   -   Recovery Using tar backup (

hacketta 04-26-2002 11:45 AM

Recovery Using tar backup
The usual "probably a stupid question" caveat applies,but here goes...

I've been experimenting with some backup and recovery scenarios on a spare machine running Red Hat 7.1. First I do a full backup with:

cd /
tar cvf /dev/st0 /

Then I randomly change some files to check that they are overwritten by the backup when I restore from tape:

cd /
tar xvf /dev/st0

The restore completes and the files are as they should be e.g. back to how they were. Next I reboot. At this point I am given warnings that the swap partitions could not be unmounted (failed) and the machine black screens. When the box restarts the BIOS ticks over then the letters LI_ appear on screen and nothing happens.

I realise I've ruined my Linux installation (not worried as this is all a test anyway) but I was wondering why. If anybody could shed some light on this it would be much appreciated as would any tips on the best ways of using tar to backup your entire system to tape (all the things I've found seem to suggest I'm doing it right, although some exclude /proc but I can't seem to do this when it's to tape e.g. back up all except /proc).



ph34r3d 04-26-2002 08:16 PM

try make a tar file name like :

tar zcvf "blah.tar.gz" / and so on..

It doesn't look like you actually created a file name, I may be wrong in this, but that is what it all looks like.

hacketta 04-29-2002 04:20 AM

Thanks for the tip, but I'm not sure if that's the problem. My understanding was that when writing to tape you don't specify an archive name, though I may well be wrong. The files were definitely backed up because tar -tvf /dev/st0 produced a huge list of files. Thanks. Austin.

hacketta 05-01-2002 11:40 AM

OK, I think I've sorted this now. So for the benefit of others:

I wasn't really going about this the right way. Some files like shared libraries, /proc etc. cannot be restored to a running system. So, you need to boot your machine using a rescue disk. There is a boot disk how to at . The rescue floppy needs to have the modules for your tape drive, and you'll need tools like tar, mkswap, mke2fs etc. You'll need the libraries required for these commands too (or use statically linked versions). Also you need to be sure your tar backup is relative (leading member names removed, tar does this by default). Boot up using the boot disk, and then recreare your partitions, and swap partitions. Format the file systems, mount the new root under /mnt, and also mount the others filesystems. Restore your backup:

tar xvf /dev/st0 -C /mnt

Reboot and run lilo to restore the MBR.

If all this sound too daunting, like it did to me then help is at hand. There is a tool called mkcdrec. Using this you can create a bootable iso image and burn it to CD. Also you can backup your files. By booting from the CD you can run a script dynamically created by mkcdrec that will resore your system. Definitely worth it.

All times are GMT -5. The time now is 06:55 AM.