The restoration of a backup depends on which program, media, and schedule you used to make it. We won't cover all the restore cases, but only mention that in order to recover your settings and data files, make sure that you restore the files and/or directories to the same places they were in when you made the backup.
Now, we will see a little script to restore the backup we made with tar using the script introduced earlier in the section called “Backup Example Using tar”
You need write permissions on the files and directories you are going to restore. Otherwise the restore operation will fail.
#!/bin/bash # Extract a compressed backup of all the directories specified # putting the backed up files into their original places. BACKUP_SOURCE_DIR="/backups" RESTORE_FILENAME=$1 # Uncomment the following line if you are restoring GZipped # backups #tar xvzf $BACKUP_SOURCE_DIR/$RESTORE_FILENAME # Restore a BZipped backup here... tar xvjf $BACKUP_SOURCE_DIR/$RESTORE_FILENAME |
As you can see, this script is simple enough. All we have to do is to pass it the file name of the backup we want to restore as a parameter (just the file name, not the full path), and it restores the backed up files into their original locations.
There is a way to be prepared in case of “total disaster”, and that is making a full backup of your system. Programs such as mkCDrec can be very useful to get you up and running in a matter of minutes.
If you are the proud owner of a Mandrake Linux –– PowerPack Edition™, you already have this tool in the “contribs” CD-ROM. Otherwise, you can find it, together with its documentation on the mkCDrec web site.
mkCDrec allows you to do multiple-CD-ROM volumes, disk cloning (copying the full contents of a disk or partition to another one with similar characteristics –– at least the same size), and many more.
In order to restore a system with mkCDrec you just have to boot with the first CD-ROM of the multiple-CD-ROM volume and follow the on-screen instructions.