>I have to do a complete restore of a host that has many partitions
>(~60). My dump cycle is 20 days, so if I use amrecover, which only
>allows one partition per extraction, I have to change tapes a lot of
>times.
>
>What I would like to do is going through all the tapes in the last
>dump cycle one by one and extract the relevant partitions from each
>tape, so I only have to change tapes 20 times.
>
>Does anyone have a good solution for this problem?
First, are you planning on reloading the needed images to disk (e.g.
your holding disk) and then restoring the host from there? Or do you
want to actually do the restore directly from tape?
If the former, then the idea from Johannes Niess is OK, but probably
a lot more work than needed. For instance, you might go through all
the effort (time) of reading an entire tape, only to have everything
it brought back overlaid by the next tape. For instance, if there is
a a level 1 of disk X on both tapes, only the later one is of interest.
Even more important, if you've brought back level 1 and 2 and then find
a level 0, the level 1 and 2 should be removed/ignored.
If you're not going to reload to disk images first, or dealing with
the "old" images I mentioned above will be a problem, then you need a
different plan.
Assuming you have all the Amanda database information (if you don't,
I'd get it back first), what I would do is this:
* Run "amadmin <config> info <host>". This will generate a listing
of the most recent backup image of each level for each disk on
that host.
Output looks like this (abbreviated):
Current info for clerk.cc.purdue.edu /u76:
...
Dumps: lev datestmp tape file origK compK secs
0 20010318 040049/RCD 304 2392896 2392928 917
1 20010320 040051/RCD 265 146057 146080 176
2 20010323 040054/RCD 270 240712 240736 255
Warning: if you're running something prior to 2.4.2, the database
may report old images that are no longer "active". For instance,
in the above example, it might report a level 3 backup that was in
the previous dump cycle.
* The following (ksh) script reduces the output to something that can
be worked with normal Unix tools:
rm list-of-tapes
egrep '^Current|^ *[0-9]' < amadmin.output \
| while read lev datestmp tape file thisdisk junk
do
if [ $lev = Current ]
then
disk=$thisdisk
last_datestmp=0
continue
fi
if [ $datestmp -lt $last_datestmp ]
then
continue # only needed for pre-2.4.2
fi
echo $lev:$datestmp:$tape:$file:$disk >> list-of-tapes
last_datestmp=$datestmp
done
The output has five colon separated columns:
1: dump level
2: date stamp
3: tape
4: file on tape
5: disk
* Use sort with the -u (unique) flag to get a list of tapes you'll need:
sort -t: -u +2 -3 < list-of-tapes | cut -d: -f3
Here's the list for the system I'm checking this out on:
040041/RCD
040048/RCD
040049/RCD
040051/RCD
040052/RCD
040053/RCD
040054/RCD
This configuration has a dumpcycle of 14 days, but notice I only
need to process 7 tapes.
* Now, sort the list by datestamp and position on tape (and get rid
of the trailing colon on the disk):
cut -d: -f1-5 < list-of-tapes \
| sort -t: +1n -2 +3n -4 > list-of-tapes-sorted
The output looks like this (from my sample system):
0:20010310:040041/RCD:311:/sas810
0:20010317:040048/RCD:264:/other_docs
0:20010317:040048/RCD:311:/apps
0:20010318:040049/RCD:262:/RCD
0:20010318:040049/RCD:266:/var
0:20010318:040049/RCD:276:/nim
0:20010318:040049/RCD:304:/u76
0:20010318:040049/RCD:309:/sas800
1:20010320:040051/RCD:265:/u76
0:20010320:040051/RCD:289:/punch
0:20010321:040052/RCD:155:/amanda2
0:20010321:040052/RCD:283:/
0:20010322:040053/RCD:105:/home
0:20010322:040053/RCD:314:/usr
1:20010323:040054/RCD:10:/apps
1:20010323:040054/RCD:81:/var
1:20010323:040054/RCD:112:/amanda2
1:20010323:040054/RCD:166:/punch
1:20010323:040054/RCD:179:/sas800
1:20010323:040054/RCD:184:/other_docs
1:20010323:040054/RCD:186:/home
1:20010323:040054/RCD:204:/sas810
1:20010323:040054/RCD:212:/RCD
1:20010323:040054/RCD:217:/nim
1:20010323:040054/RCD:221:/
1:20010323:040054/RCD:255:/usr
2:20010323:040054/RCD:270:/u76
0:20010323:040054/RCD:312:/u77
Note that, for instance, the only image of interest for /u77 is the
full dump on the last tape, 040054/RCD, yet if I had processed the
whole tape of each of the others, it would have for sure found old
uninteresting images of /u77 from the previous cycle.
* Now it's just a matter of going down this list in order. Note that
with the file position available to you, you can use "mt fsf" to
skip over all the images that are not of interest, which is probably
a lot faster than letter amrestore do it (many modern tape devices
have a high speed search capability).
You can also grep this list for a particular disk if you need to
get it online faster than the mass of others.
Warning: the above code will have trouble if any of your tape labels
or disk names have colons in them. But you can change the separator
used in the sort and cut calls to something else.
>Jens Bech Madsen
John R. Jackson, Technical Software Specialist, [EMAIL PROTECTED]