provide correct exit values
[unix-history] / usr / src / sbin / restore / restore.8
CommitLineData
85d07773
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
0ede5384 5.\" @(#)restore.8 6.6 (Berkeley) %G%
85d07773 6.\"
da406866 7.TH RESTORE 8 ""
85d07773
KM
8.UC 4
9.SH NAME
95c6920e 10restore \- incremental file system restore
85d07773 11.SH SYNOPSIS
95c6920e
KM
12.B /etc/restore
13key [ name ... ]
85d07773 14.SH DESCRIPTION
95c6920e
KM
15.PP
16.I Restore
17reads tapes dumped with the
18.IR dump (8)
85d07773 19command.
95c6920e
KM
20Its actions are controlled by the
21.I key
22argument.
85d07773
KM
23The
24.I key
95c6920e
KM
25is a string of characters containing
26at most one function letter and possibly
27one or more function modifiers.
28Other arguments to the command are file or directory
29names specifying the files that are to be restored.
30Unless the
31.B h
32key is specified (see below),
33the appearance of a directory name refers to
34the files and (recursively) subdirectories of that directory.
85d07773 35.PP
95c6920e
KM
36The function portion of
37the key is specified by one of the following letters:
38.TP 5n
39.B r
40The tape
41is read and loaded into the current directory.
42This should not be done lightly; the
85d07773 43.B r
95c6920e 44key should only be used to restore
85d07773 45a complete dump tape onto a clear file system
95c6920e 46or to restore an incremental dump tape after a full level zero restore.
85d07773 47Thus
95c6920e
KM
48.IP "" 5n
49 /etc/newfs /dev/rrp0g eagle
85d07773 50.br
95c6920e
KM
51 /etc/mount /dev/rp0g /mnt
52.br
53 cd /mnt
54.br
55 restore r
56.IP "" 5n
85d07773
KM
57is a typical sequence to restore a complete dump.
58Another
95c6920e 59.I restore
85d07773
KM
60can be done to get an incremental dump
61in on top of this.
95c6920e
KM
62Note that
63.I restore
64leaves a file
0ede5384 65.I restoresymtable
95c6920e
KM
66in the root directory to pass information between incremental
67restore passes.
68This file should be removed when the last incremental tape has been
69restored.
70.br
85d07773 71A
95c6920e 72.IR dump (8)
85d07773 73followed by a
95c6920e 74.IR newfs (8)
85d07773 75and a
95c6920e
KM
76.I restore
77is used to change the size of a file system.
78.TP 5n
79.B R
80.I Restore
81requests a particular tape of a multi volume set on which to restart
82a full restore
83(see the
84.B r
85key above).
86This allows
87.I restore
88to be interrupted and then restarted.
89.TP 5n
90.B x
91The named files are extracted from the tape.
92If the named file matches a directory whose contents
93had been written onto the tape,
94and the
95.B h
96key is not specified,
97the directory is recursively extracted.
98The owner, modification time,
99and mode are restored (if possible).
100If no file argument is given,
101then the root directory is extracted,
102which results in the entire content of the
103tape being extracted,
104unless the
105.B h
106key has been specified.
107.TP 5n
108.B t
109The names of the specified files are listed if they occur
110on the tape.
111If no file argument is given,
112then the root directory is listed,
113which results in the entire content of the
114tape being listed,
115unless the
116.B h
117key has been specified.
118Note that the
119.B t
120key replaces the function of the old
121.I dumpdir
122program.
123.TP 5n
124.B i
125This mode allows interactive restoration of files from a dump tape.
126After reading in the directory information from the tape,
127.I restore
128provides a shell like interface that allows the user to move
129around the directory tree selecting files to be extracted.
130The available commands are given below;
131for those commands that require an argument,
132the default is the current directory.
133.IP "" 10n
134.ti -5n
85d07773 135.br
95c6920e
KM
136.B ls
137[arg] \-
138List the current or specified directory.
139Entries that are directories are appended with a ``/''.
140Entries that have been marked for extraction are prepended with a ``*''.
141If the verbose key is set the inode number of each entry is also listed.
142.ti -5n
143.sp
144.B cd
145arg \-
146Change the current working directory to the specified argument.
147.ti -5n
148.sp
149.B pwd
150\-
151Print the full pathname of the current working directory.
152.ti -5n
153.sp
154.B add
155[arg] \-
156The current directory or specified argument is added to the list of
157files to be extracted.
158If a directory is specified, then it and all its descendents are
159added to the extraction list
160(unless the
161.B h
162key is specified on the command line).
163Files that are on the extraction list are prepended with a ``*''
164when they are listed by
165.BR ls .
166.ti -5n
167.sp
168.B delete
169[arg] \-
170The current directory or specified argument is deleted from the list of
171files to be extracted.
172If a directory is specified, then it and all its descendents are
173deleted from the extraction list
174(unless the
175.B h
176key is specified on the command line).
177The most expedient way to extract most of the files from a directory
178is to add the directory to the extraction list and then delete
179those files that are not needed.
180.ti -5n
181.sp
182.B extract
183\-
184All the files that are on the extraction list are extracted
185from the dump tape.
186.I Restore
187will ask which volume the user wishes to mount.
188The fastest way to extract a few files is to
189start with the last volume, and work towards the first volume.
190.ti -5n
191.sp
78fda31e
KM
192.B setmodes
193\-
194All the directories that have been added to the extraction list
195have their owner, modes, and times set;
196nothing is extracted from the tape.
197This is useful for cleaning up after a restore has been prematurely aborted.
198.ti -5n
199.sp
95c6920e
KM
200.B verbose
201\-
202The sense of the
203.B v
204key is toggled.
205When set, the verbose key causes the
206.B ls
207command to list the inode numbers of all entries.
208It also causes
209.I restore
210to print out information about each file as it is extracted.
211.ti -5n
212.sp
213.B help
214\-
215List a summary of the available commands.
216.ti -5n
217.sp
218.B quit
219\-
220Restore immediately exits,
221even if the extraction list is not empty.
222.sp
223.PP
224The following characters may be used in addition to the letter
225that selects the function desired.
226.TP 5n
0c7dc5b1
KM
227.B b
228The next argument to
95c6920e 229.I restore
0c7dc5b1
KM
230is used as the block size of the tape (in kilobytes).
231If the \fB-b\fP option is not specified,
232.I restore
233tries to determine the tape block size dynamically.
95c6920e
KM
234.TP 5n
235.B f
236The next argument to
237.I restore
238is used as the name of the archive instead
239of /dev/rmt?.
240If the name of the file is ``\-'',
241.I restore
242reads from standard input.
243Thus,
244.IR dump (8)
245and
246.I restore
247can be used in a pipeline to dump and restore a file system
248with the command
249.IP "" 5n
250 dump 0f - /usr | (cd /mnt; restore xf -)
251.TP 5n
0c7dc5b1
KM
252.B v
253Normally
254.I restore
255does its work silently.
256The
257.B v
258(verbose)
259key causes it to type the name of each file it treats
260preceded by its file type.
261.TP 5n
95c6920e
KM
262.B y
263.I Restore
264will not ask whether it should abort the restore if gets a tape error.
265It will always try to skip over the bad tape block(s) and continue as
266best it can.
267.TP 5n
268.B m
269.I Restore
270will extract by inode numbers rather than by file name.
271This is useful if only a few files are being extracted,
272and one wants to avoid regenerating the complete pathname
273to the file.
274.TP 5n
275.B h
276.I Restore
277extracts the actual directory,
278rather than the files that it references.
279This prevents hierarchical restoration of complete subtrees
280from the tape.
7da35c13
JL
281.TP 5n
282.B s
283The next argument to
284.I restore
285is a number which
286selects the file on a multi-file dump tape. File numbering
287starts at 1.
85d07773 288.SH DIAGNOSTICS
95c6920e
KM
289Complaints about bad key characters.
290.PP
291Complaints if it gets a read error.
292If
293.B y
294has been specified, or the user responds ``y'',
295.I restore
296will attempt to continue the restore.
85d07773
KM
297.PP
298If the dump extends over more than one tape,
95c6920e
KM
299.I restore
300will ask the user to change tapes.
301If the
302.B x
303or
304.B i
305key has been specified,
306.I restore
307will also ask which volume the user wishes to mount.
308The fastest way to extract a few files is to
309start with the last volume, and work towards the first volume.
310.PP
311There are numerous consistency checks that can be listed by
312.IR restore .
313Most checks are self-explanatory or can ``never happen''.
314Common errors are given below.
315.IP "Converting to new file system format." 5n
316.br
317A dump tape created from the old file system has been loaded.
318It is automatically converted to the new file system format.
319.IP "<filename>: not found on tape" 5n
320.br
321The specified file name was listed in the tape directory,
322but was not found on the tape.
323This is caused by tape read errors while looking for the file,
324and from using a dump tape created on an active file system.
325.IP "expected next file <inumber>, got <inumber>" 5n
326.br
327A file that was not listed in the directory showed up.
328This can occur when using a dump tape created on an active file system.
329.IP "Incremental tape too low" 5n
330.br
331When doing incremental restore,
332a tape that was written before the previous incremental tape,
333or that has too low an incremental level has been loaded.
334.IP "Incremental tape too high" 5n
335.br
336When doing incremental restore,
337a tape that does not begin its coverage where the previous incremental
338tape left off,
339or that has too high an incremental level has been loaded.
340.IP "Tape read error while restoring <filename>" 5n
341.ti -5n
342.br
343Tape read error while skipping over inode <inumber>
344.ti -5n
345.br
346Tape read error while trying to resynchronize
347.br
348A tape read error has occurred.
349If a file name is specified,
350then its contents are probably partially wrong.
351If an inode is being skipped or the tape is trying to resynchronize,
352then no extracted files have been corrupted,
353though files may not be found on the tape.
354.IP "resync restore, skipped <num> blocks" 5n
355.br
356After a tape read error,
357.I restore
358may have to resynchronize itself.
359This message lists the number of blocks that were skipped over.
360.SH FILES
361/dev/rmt? the default tape drive
362.br
363/tmp/rstdir* file containing directories on the tape.
364.br
365/tmp/rstmode* owner, mode, and time stamps for directories.
366.br
ded6436e 367\&./restoresymtable information passed between incremental restores.
95c6920e
KM
368.SH SEE ALSO
369rrestore(8C) dump(8), newfs(8), mount(8), mkfs(8)
85d07773 370.SH BUGS
95c6920e
KM
371.I Restore
372can get confused when doing incremental restores from
373dump tapes that were made on active file systems.
374.PP
375A level zero dump must be done after a full restore.
376Because restore runs in user code,
377it has no control over inode allocation;
378thus a full restore must be done to get a new set of directories
379reflecting the new inode numbering,
380even though the contents of the files is unchanged.