October 01, 2005

restore of Tower of Hanoi Backups from dump

I just suffered through figuring out how to restore the daily backups I make using a shell script I wrote to use dump to make backups in the tower of hanoi sequence. Yes, I know, I should already have had this figured out, but not having done so was probably due to the same stupidity that caused my pinky finger to twitch before I finished typing the command I wanted to type and sending:

rm -rf /home/cvs/

to the system, deleting all my precious cvs repositories. (I was trying to delete one so that I could rebuild it, and certainly didn't want to delete all of them).

This How-To has already done a nice job of explaining a bit about how the tower of hanoi sequence works, so I won't go into it here. I found the restore command extremely hard to grok, due to a few misunderstandings and some bad (IMHO) quidance in the tool.

The first thing that I was unsure about was what order I should restore my backups in. You should restore the older backups first, as the more recent backups update the older ones.

One of the biggest sources of confusion for me was that the dump/restore combo were originally written for tape backups and allow you to span large backups over multiple tabe volumes. I misread guidance about volumes in multiple places to be talking about different incremental backups. I had it in my head that I should run the restore command once, and then feed the different incremental backups in one by one, but that is not the case.

It is hard to explain all the different things I tried without going through them again and pasting the results here, and I need to get back to some other work, so quickly here is a summary of my restore process.

My most recent backup was from about 1A.M. Saturday morning. I have a weekly backup cycle with dump levels as follows:

Sun - 0
Mon - 3
Tue - 2
Wed - 5
Thu - 4
Fri - 7
Sat - 6

This means that I need to restore my backups in the order: Sun > Tue > Thu > Sat (read the howto above if that isn't clear to you) I kept trying to do this all inside one restore session, but that isn't how it works. Here was the process that finally did work:

mkdir ~/restore
cd ~/restore
restore -iv -f /backup/home.dump0
^^^ This contains Sundays full backup of the /home directory
restore > add cvs
^^^ at this point a whole bunch of Make node lines scroll by
restore > extract
Extract requested files
You have not read any tapes yet.
If you are extracting just a few files, start with the last volume
and work towards the first; restore can quickly skip tapes that
have no further files to extract. Otherwise, begin with volume 1.
Specify next volume #: 
^^^ here we enter 1 and a whole bunch of files are extracted to ~/restore/cvs
set owner/mode for '.'? [yn] y
restore > quit
restore -iv -f /backup/home.dump2
restore -iv -f /backup/home.dump4
restore -iv -f /backup/home.dump6
^^^ we repeat the extract process in these restore sessions exactly as we did with the full backup, but this time it will probably write a lot less.
mv /home/cvs /home/cvs.bak
mv ~/restore/cvs /home
rmdir ~/restore

And we're done. Note for myself, be sure to use the write paths for the backup files or else none of this will work.

Posted by ultrabob at October 1, 2005 01:23 PM
Comments
Post a comment









Remember personal info?