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