3 Prev Part I. Installation Next
5 -------------------------------------------------------------------------------
12 Original text<dmoore@jeffco.k12.co.us>
18 <oliva@dcc.unicamp.br>>
22 Corrections and additions<jam@philabs.research.philips.com>
26 Corrections and additions<ralf@atg.venture.de>
30 XML-conversion;Updates
33 This document describes how to restore files backed up with Amanda either with
34 or without Amanda tools.
35 All these cases assume you're trying to restore a complete disk, that is,
36 you've replaced the lost disk with a new one, or created a new filesystem on
37 it. Tweaking with the arguments to restore (not amrestore), you will be able to
38 restore individual files.
39 Also, this text does not cover amrecover, a program that provides a text user
40 interface similar to interactive restore (restore -i), but it allows you to
41 select individual files to recover and automatically determines the tapes where
42 they were stored. The backups must be performed with the `index' option enabled
44 I considered the following cases.
45 The server machine (machine Aaron) runs solaris, the client machine (machine
48 1. Client machine fails, non-system critical.
49 Example: /home fails on Barney.
50 First, use amadmin to find the tapes most recently used to backup the
53 amadmin <config> info Barney '/home$'
55 Current info for Barney /home:
56 Stats: dump rates (kps), Full: 41.1, 33.1, 38.8
57 Incremental: 9.5, 2.1, 24.7
58 compressed size, Full: 63.1%, 54.0%, 52.9%
59 Incremental: 43.7%, 15.5%, 47.8%
60 Dumps: lev datestmp tape file origK compK secs
61 0 19971223 Barney01 16 329947 208032 5060
62 1 19980108 Barney16 8 1977 864 91
63 2 19971222 Barney06 7 1874 672 83
64 3 19970926 Barney03 11 12273 3040 211
66 This tells us that we will need two tapes to do a full restore (Barney01,
67 Barney16). Note that, even if Barney06 and Barney03 are listed, they are
68 actually older than the full backup, so they should not be used to restore
70 Log into Barney. Cd to the /home directory. Insert the tape with the level
71 0 dump on it into the tape drive of Aaron.
72 Become super-user in the client host and run (replace <amanda> with the
73 username under which amanda runs):
75 rsh -n -l <amanda> Aaron amrestore -p /dev/rmt/0cn Barney '/home\$' |
78 This requires client root to have login access to <amanda>@Aaron, with a
79 .rhosts entry (.amandahosts won't do). If you use ssh, you may be able to
80 type a password in order to be authenticated. Another alternative is to
81 start the operation in the server, and rsh to the client. You should be
82 the amanda user or root in the tape server and run:
84 amrestore -p /dev/rmt/0cn Barney '/home$' |
85 rsh Barney -l root /usr/etc/restore -ivbf 2 -
87 If you don't want to use rsh at all, you may run:
89 amrestore /dev/rmt/0cn Barney '/home$'
91 This should create a file whose name contains the hostname, directory
92 name, dump level and dump date of the backup. Now you have to move this
93 file to the client somehow: you may use NFS, rcp, ftp, floppy disks :-),
94 whatever. Suppose you rename that file to `home.0'. Then, on the client,
95 you should become root and run:
97 restore -ivbf 2 home.0
99 Repeat one of these steps, incrementing the level of the dump, until there
100 are no more available backups.
101 2. Client machine fails, system critical disk.
102 Example: / fails on Barney.
103 First of all, boot off the CD, and reinstall the system critical
104 partition, restoring it to vendor supplied state. Then, go through all of
106 3. Server machine fails, non-system critical, non-Amanda disk.
107 Proceed just as described in Scenario 1. However, you won't have to go
108 through the rsh process, because you can just use amrestore to replace the
110 4. Server machine fails, system critical, non-Amanda disk.
112 First of all, boot off the CD, and reinstall the system critical
113 partition, restoring it to vendor supplied state.
114 Then, follow steps in Scenario 3.
115 5. Server machine fails, non-system critical, Amanda disk, with db.
116 Example: /opt on Aaron
117 If the disk that contains the Amanda database is toast, then you need to
118 rebuild the database. The easiest way to do it is to take the text file
119 that you had mailed to you via the 'amadmin export' command, and import
120 via the 'amadmin import' command. Then you should be able to follow the
121 steps outlined in Scenario 4.
122 Note that Amanda does not mail the exported database automatically; you
123 may add this to the crontab entry that runs amanda.
124 Maybe it's a good idea to print out the text files as well and store the
125 last 2 dumpcycles worth of paper (the disc text files might have got
126 toasted as well). From the paper you still are able to reconstruct where
128 6. Server machine fails, non-system critical, Amanda disk, with binaries.
129 Example: /usr/local on Aaron
130 This is where things get hairy. If the disk with the amanda binaries on it
131 is toast, you have three options.
133 i. reinstall the Amanda binaries from another tape, on which you have
134 conveniently backed up the binaries within the last couple of weeks
136 ii. recompile Amanda, making sure not to overwrite your db files.
137 iii. use dd to read Amanda formatted tapes. This is the option I am going
138 to explore most fully, because this seems the most likely to occur.
140 a. Find out the device name used by Amanda, by looking in
141 amanda.conf. Turns out to be /dev/rmt/0cn for this system.
142 If amanda.conf isn't at hand: this must be a non-rewinding tape
143 device specifier (which I believe the trailing `n' stands for).
144 b. Look over the copy of the output of 'amadmin <config> export',
145 and find out which tapes /usr/local was backed up on.
146 c. Grab the tapes that /opt was backed up on, and stick the level 0
147 into the drive. cd to /usr/local.
148 d. Skip the first record, which is just the tape header, by using
149 the appropriate tape command.
151 mt -f /dev/rmt/0cn fsf 1
153 e. Now you want to start looking for /usr/local on this tape.
155 dd if=/dev/rmt/0cn bs=32k skip=1 | gzip -d | /usr/sbin/
158 This command gives us an interactive restore of this record,
159 including telling us what partition, what host, and what level
160 the backup was. The gzip -d portion of the pipe can be omitted
161 if there was no compression.
162 f. If you don't find /usr/local on the first try, quit ufsrestore,
163 and move forward one record.
165 mt -f /dev/rmt/0cn fsf 1
167 and try the dd/restore command shown above. Do this until you
168 find /opt on the disk.
169 Another possibility: quick and dirty tape index in case you
170 don't know which partition /usr/local was on: (from
171 <ralf@atg.venture.de>)
175 while mt -f $TAPEDEV fsf 1 ; do
176 dd if=$TAPEDEV bs=32k count=1 | head -1
182 Amanda: FILE 19971220 uri /root-sun4 lev 1 comp .gz program
184 Amanda: FILE 19971220 uri /misc lev 1 comp .gz program DUMP
185 Amanda: FILE 19971220 uri / lev 1 comp .gz program DUMP
187 g. Restore the Amanda binaries (what else do you need??), and then
188 bail out of ufsrestore. You can use amrestore, as in Scenario 3.
195 Refer to http://www.amanda.org/docs/restore.html for the current version of
197 -------------------------------------------------------------------------------
200 Chapter 5. Backup PC hosts using Samba Home Part II. About Tapes and Changers