xref: /csrg-svn/sbin/restore/restore.8 (revision 69156)
161536Sbostic.\" Copyright (c) 1985, 1991, 1993
261536Sbostic.\"	The Regents of the University of California.  All rights reserved.
318914Smckusick.\"
443800Strent.\" %sccs.include.redist.man%
518914Smckusick.\"
6*69156Smckusick.\"     @(#)restore.8	8.4 (Berkeley) 05/01/95
736105Sbostic.\"
847463Scael.Dd
947463Scael.Dt RESTORE 8
1047463Scael.Os BSD 4
1147463Scael.Sh NAME
1247463Scael.Nm restore
1347463Scael.Nd "restore files or file systems from backups made with dump"
1447463Scael.Sh SYNOPSIS
1547463Scael.Nm restore
16*69156Smckusick.Fl i
17*69156Smckusick.Op Fl chmvy
18*69156Smckusick.Op Fl b Ar blocksize
19*69156Smckusick.Op Fl f Ar file
20*69156Smckusick.Op Fl s Ar fileno
21*69156Smckusick.Nm restore
22*69156Smckusick.Fl R
23*69156Smckusick.Op Fl cvy
24*69156Smckusick.Op Fl b Ar blocksize
25*69156Smckusick.Op Fl f Ar file
26*69156Smckusick.Op Fl s Ar fileno
27*69156Smckusick.Nm restore
28*69156Smckusick.Fl r
29*69156Smckusick.Op Fl cvy
30*69156Smckusick.Op Fl b Ar blocksize
31*69156Smckusick.Op Fl f Ar file
32*69156Smckusick.Op Fl s Ar fileno
33*69156Smckusick.Nm restore
34*69156Smckusick.Fl t
35*69156Smckusick.Op Fl chvy
36*69156Smckusick.Op Fl b Ar blocksize
37*69156Smckusick.Op Fl f Ar file
38*69156Smckusick.Op Fl s Ar fileno
39*69156Smckusick.Op file ...
40*69156Smckusick.Nm restore
41*69156Smckusick.Fl x
42*69156Smckusick.Op Fl chmvy
43*69156Smckusick.Op Fl b Ar blocksize
44*69156Smckusick.Op Fl f Ar file
45*69156Smckusick.Op Fl s Ar fileno
46*69156Smckusick.Op file ...
47*69156Smckusick.Pp
48*69156Smckusick.in -\\n(iSu
49*69156Smckusick(The
50*69156Smckusick.Bx 4.3
51*69156Smckusickoption syntax is implemented for backward compatibility, but
52*69156Smckusickis not documented here.)
5347463Scael.Sh DESCRIPTION
5418914SmckusickThe
5547463Scael.Nm restore
5647463Scaelcommand performs the inverse function of
5747463Scael.Xr dump 8 .
5847463ScaelA full backup of a file system may be restored and
5947463Scaelsubsequent incremental backups layered on top of it.
6047463ScaelSingle files and
6147463Scaeldirectory subtrees may be restored from full or partial
6247463Scaelbackups.
6347463Scael.Nm Restore
6450906Smckusickworks across a network;
6550906Smckusickto do this see the
6650906Smckusick.Fl f
6750906Smckusickflag described below.
6818915SmckusickOther arguments to the command are file or directory
6918915Smckusicknames specifying the files that are to be restored.
7018915SmckusickUnless the
71*69156Smckusick.Fl h
72*69156Smckusickflag is specified (see below),
7318915Smckusickthe appearance of a directory name refers to
7418915Smckusickthe files and (recursively) subdirectories of that directory.
7547463Scael.Pp
76*69156SmckusickExactly one of the following flags is required:
7747463Scael.Bl -tag -width Ds
78*69156Smckusick.It Fl i
7947463ScaelThis mode allows interactive restoration of files from a dump.
8047463ScaelAfter reading in the directory information from the dump,
8147463Scael.Nm restore
8218915Smckusickprovides a shell like interface that allows the user to move
8318915Smckusickaround the directory tree selecting files to be extracted.
8418915SmckusickThe available commands are given below;
8518915Smckusickfor those commands that require an argument,
8618915Smckusickthe default is the current directory.
8747463Scael.Bl -tag -width Fl
8847463Scael.It Ic add Op Ar arg
8918915SmckusickThe current directory or specified argument is added to the list of
9018915Smckusickfiles to be extracted.
9118915SmckusickIf a directory is specified, then it and all its descendents are
9218915Smckusickadded to the extraction list
9318915Smckusick(unless the
94*69156Smckusick.Fl h
95*69156Smckusickflag is specified on the command line).
9618915SmckusickFiles that are on the extraction list are prepended with a ``*''
9718915Smckusickwhen they are listed by
9847463Scael.Ic ls .
9950484Scael.It Ic \&cd Ar arg
10050484ScaelChange the current working directory to the specified argument.
10147463Scael.It Ic delete Op Ar arg
10218915SmckusickThe current directory or specified argument is deleted from the list of
10318915Smckusickfiles to be extracted.
10418915SmckusickIf a directory is specified, then it and all its descendents are
10518915Smckusickdeleted from the extraction list
10618915Smckusick(unless the
107*69156Smckusick.Fl h
108*69156Smckusickflag is specified on the command line).
10918915SmckusickThe most expedient way to extract most of the files from a directory
11018915Smckusickis to add the directory to the extraction list and then delete
11118915Smckusickthose files that are not needed.
11247463Scael.It Ic extract
11318915SmckusickAll the files that are on the extraction list are extracted
11447463Scaelfrom the dump.
11547463Scael.Nm Restore
11618915Smckusickwill ask which volume the user wishes to mount.
11718915SmckusickThe fastest way to extract a few files is to
11818915Smckusickstart with the last volume, and work towards the first volume.
11950484Scael.It Ic help
12050484ScaelList a summary of the available commands.
12150484Scael.It Ic \&ls Op Ar arg
12250484ScaelList the current or specified directory.
12350484ScaelEntries that are directories are appended with a ``/''.
12450484ScaelEntries that have been marked for extraction are prepended with a ``*''.
125*69156SmckusickIf the verbose
126*69156Smckusickflag is set the inode number of each entry is also listed.
12750484Scael.It Ic pwd
12850484ScaelPrint the full pathname of the current working directory.
12950484Scael.It Ic quit
13050484ScaelRestore immediately exits,
13150484Scaeleven if the extraction list is not empty.
13247463Scael.It Ic setmodes
13321097SmckusickAll the directories that have been added to the extraction list
13421097Smckusickhave their owner, modes, and times set;
13547463Scaelnothing is extracted from the dump.
13621097SmckusickThis is useful for cleaning up after a restore has been prematurely aborted.
13747463Scael.It Ic verbose
13818915SmckusickThe sense of the
139*69156Smckusick.Fl v
140*69156Smckusickflag is toggled.
141*69156SmckusickWhen set, the verbose flag causes the
14247463Scael.Ic ls
14318915Smckusickcommand to list the inode numbers of all entries.
14418915SmckusickIt also causes
14547463Scael.Nm restore
14618915Smckusickto print out information about each file as it is extracted.
14747463Scael.El
148*69156Smckusick.It Fl R
149*69156Smckusick.Nm Restore
150*69156Smckusickrequests a particular tape of a multi volume set on which to restart
151*69156Smckusicka full restore
152*69156Smckusick(see the
153*69156Smckusick.Fl r
154*69156Smckusickflag below).
155*69156SmckusickThis is useful if the restore has been interrupted.
156*69156Smckusick.It Fl r
157*69156SmckusickRestore (rebuild a file system).
158*69156SmckusickThe target file system should be made pristine with
159*69156Smckusick.Xr newfs 8 ,
160*69156Smckusickmounted and the user
161*69156Smckusick.Xr cd Ns 'd
162*69156Smckusickinto the pristine file system
163*69156Smckusickbefore starting the restoration of the initial level 0 backup. If the
164*69156Smckusicklevel 0 restores successfully, the
165*69156Smckusick.Fl r
166*69156Smckusickflag may be used to restore
167*69156Smckusickany necessary incremental backups on top of the level 0.
168*69156SmckusickThe
169*69156Smckusick.Fl r
170*69156Smckusickflag precludes an interactive file extraction and can be
171*69156Smckusickdetrimental to one's health if not used carefully (not to mention
172*69156Smckusickthe disk). An example:
173*69156Smckusick.Bd -literal -offset indent
174*69156Smckusicknewfs /dev/rrp0g eagle
175*69156Smckusickmount /dev/rp0g /mnt
176*69156Smckusickcd /mnt
177*69156Smckusick
178*69156Smckusickrestore rf /dev/rst8
179*69156Smckusick.Ed
180*69156Smckusick.Pp
181*69156SmckusickNote that
182*69156Smckusick.Nm restore
183*69156Smckusickleaves a file
184*69156Smckusick.Pa restoresymtable
185*69156Smckusickin the root directory to pass information between incremental
186*69156Smckusickrestore passes.
187*69156SmckusickThis file should be removed when the last incremental has been
188*69156Smckusickrestored.
189*69156Smckusick.Pp
190*69156Smckusick.Nm Restore ,
191*69156Smckusickin conjunction with
192*69156Smckusick.Xr newfs 8
193*69156Smckusickand
194*69156Smckusick.Xr dump 8 ,
195*69156Smckusickmay be used to modify file system parameters
196*69156Smckusicksuch as size or block size.
197*69156Smckusick.It Fl t
198*69156SmckusickThe names of the specified files are listed if they occur
199*69156Smckusickon the backup.
200*69156SmckusickIf no file argument is given,
201*69156Smckusickthen the root directory is listed,
202*69156Smckusickwhich results in the entire content of the
203*69156Smckusickbackup being listed,
204*69156Smckusickunless the
205*69156Smckusick.Fl h
206*69156Smckusickflag has been specified.
207*69156SmckusickNote that the
208*69156Smckusick.Fl t
209*69156Smckusickflag replaces the function of the old
210*69156Smckusick.Xr dumpdir 8
211*69156Smckusickprogram.
212*69156Smckusick.ne 1i
213*69156Smckusick.It Fl x
214*69156SmckusickThe named files are read from the given media.
215*69156SmckusickIf a named file matches a directory whose contents
216*69156Smckusickare on the backup
217*69156Smckusickand the
218*69156Smckusick.Fl h
219*69156Smckusickflag is not specified,
220*69156Smckusickthe directory is recursively extracted.
221*69156SmckusickThe owner, modification time,
222*69156Smckusickand mode are restored (if possible).
223*69156SmckusickIf no file argument is given,
224*69156Smckusickthen the root directory is extracted,
225*69156Smckusickwhich results in the entire content of the
226*69156Smckusickbackup being extracted,
227*69156Smckusickunless the
228*69156Smckusick.Fl h
229*69156Smckusickflag has been specified.
23050484Scael.El
23147463Scael.Pp
232*69156SmckusickThe following additional options may be specified:
23347463Scael.Bl -tag -width Ds
234*69156Smckusick.It Fl b Ar blocksize
235*69156SmckusickThe number of kilobytes per dump record.
23647463ScaelIf the
23747463Scael.Fl b
23847463Scaeloption is not specified,
23947463Scael.Nm restore
240*69156Smckusicktries to determine the block size dynamically.
241*69156Smckusick.It Fl c
242*69156SmckusickNormally,
24347463Scael.Nm restore
244*69156Smckusickwill try to determine dynamically whether the dump was made from an
245*69156Smckusickold (pre-4.4) or new format file sytem.  The
246*69156Smckusick.Fl c
247*69156Smckusickflag disables this check, and only allows reading a dump in the old
248*69156Smckusickformat.
249*69156Smckusick.It Fl f Ar file
250*69156SmckusickRead the backup from
251*69156Smckusick.Ar file ;
252*69156Smckusick.Ar file
253*69156Smckusickmay be a special device file
254*69156Smckusicklike
255*69156Smckusick.Pa /dev/rmt12
256*69156Smckusick(a tape drive),
257*69156Smckusick.Pa /dev/rsd1c
258*69156Smckusick(a disk drive),
259*69156Smckusickan ordinary file,
260*69156Smckusickor
261*69156Smckusick.Ql Fl
262*69156Smckusick(the standard input).
26350906SmckusickIf the name of the file is of the form
26450906Smckusick.Dq host:file ,
265*69156Smckusickor
266*69156Smckusick.Dq user@host:file ,
26750906Smckusick.Nm restore
26850906Smckusickreads from the named file on the remote host using
26950906Smckusick.Xr rmt 8 .
27047463Scael.Pp
271*69156Smckusick.It Fl h
272*69156SmckusickExtract the actual directory,
27350484Scaelrather than the files that it references.
27450484ScaelThis prevents hierarchical restoration of complete subtrees
27550484Scaelfrom the dump.
276*69156Smckusick.It Fl m
277*69156SmckusickExtract by inode numbers rather than by file name.
27850484ScaelThis is useful if only a few files are being extracted,
27950484Scaeland one wants to avoid regenerating the complete pathname
28050484Scaelto the file.
281*69156Smckusick.It Fl s Ar fileno
282*69156SmckusickRead from the specified
283*69156Smckusick.Ar fileno
284*69156Smckusickon a multi-file tape.
285*69156SmckusickFile numbering starts at 1.
286*69156Smckusick.It Fl v
28726952SmckusickNormally
28847463Scael.Nm restore
28926952Smckusickdoes its work silently.
29026952SmckusickThe
291*69156Smckusick.Fl v
29226952Smckusick(verbose)
293*69156Smckusickflag causes it to type the name of each file it treats
29426952Smckusickpreceded by its file type.
295*69156Smckusick.It Fl y
296*69156SmckusickDo not ask the user whether to abort the restore in the event of an error.
297*69156SmckusickAlways try to skip over the bad block(s) and continue.
29847463Scael.El
29947463Scael.Sh DIAGNOSTICS
30018915SmckusickComplaints if it gets a read error.
30118915SmckusickIf
302*69156Smckusick.Fl y
30347463Scaelhas been specified, or the user responds
30447463Scael.Ql y ,
30547463Scael.Nm restore
30618915Smckusickwill attempt to continue the restore.
30747463Scael.Pp
30847463ScaelIf a backup was made using more than one tape volume,
30947463Scael.Nm restore
31047463Scaelwill notify the user when it is time to mount the next volume.
31118915SmckusickIf the
312*69156Smckusick.Fl x
31318915Smckusickor
314*69156Smckusick.Fl i
315*69156Smckusickflag has been specified,
31647463Scael.Nm restore
31718915Smckusickwill also ask which volume the user wishes to mount.
31818915SmckusickThe fastest way to extract a few files is to
31918915Smckusickstart with the last volume, and work towards the first volume.
32047463Scael.Pp
32118915SmckusickThere are numerous consistency checks that can be listed by
32247463Scael.Nm restore .
32318915SmckusickMost checks are self-explanatory or can ``never happen''.
32418915SmckusickCommon errors are given below.
32547463Scael.Pp
32647463Scael.Bl -tag -width Ds -compact
32747463Scael.It Converting to new file system format.
32818915SmckusickA dump tape created from the old file system has been loaded.
32918915SmckusickIt is automatically converted to the new file system format.
33047463Scael.Pp
33147463Scael.It <filename>: not found on tape
33218915SmckusickThe specified file name was listed in the tape directory,
33318915Smckusickbut was not found on the tape.
33418915SmckusickThis is caused by tape read errors while looking for the file,
33518915Smckusickand from using a dump tape created on an active file system.
33647463Scael.Pp
33747463Scael.It expected next file <inumber>, got <inumber>
33818915SmckusickA file that was not listed in the directory showed up.
33947463ScaelThis can occur when using a dump created on an active file system.
34047463Scael.Pp
34147463Scael.It Incremental dump too low
34218915SmckusickWhen doing incremental restore,
34347463Scaela dump that was written before the previous incremental dump,
34418915Smckusickor that has too low an incremental level has been loaded.
34547463Scael.Pp
34647463Scael.It Incremental dump too high
34718915SmckusickWhen doing incremental restore,
34847463Scaela dump that does not begin its coverage where the previous incremental
34947463Scaeldump left off,
35018915Smckusickor that has too high an incremental level has been loaded.
35147463Scael.Pp
35247463Scael.It Tape read error while restoring <filename>
35347463Scael.It Tape read error while skipping over inode <inumber>
35447463Scael.It Tape read error while trying to resynchronize
35547463ScaelA tape (or other media) read error has occurred.
35618915SmckusickIf a file name is specified,
35718915Smckusickthen its contents are probably partially wrong.
35818915SmckusickIf an inode is being skipped or the tape is trying to resynchronize,
35918915Smckusickthen no extracted files have been corrupted,
36018915Smckusickthough files may not be found on the tape.
36147463Scael.Pp
36247463Scael.It resync restore, skipped <num> blocks
36347463ScaelAfter a dump read error,
36447463Scael.Nm restore
36518915Smckusickmay have to resynchronize itself.
36618915SmckusickThis message lists the number of blocks that were skipped over.
36747463Scael.El
36847463Scael.Sh FILES
36947463Scael.Bl -tag -width "./restoresymtable" -compact
37047463Scael.It Pa /dev/rmt?
37147463Scaelthe default tape drive
37247463Scael.It Pa /tmp/rstdir*
37347463Scaelfile containing directories on the tape.
37447463Scael.It Pa /tmp/rstmode*
37547463Scaelowner, mode, and time stamps for directories.
37647463Scael.It Pa \&./restoresymtable
37747463Scaelinformation passed between incremental restores.
37847463Scael.El
37947463Scael.Sh SEE ALSO
38047463Scael.Xr dump 8 ,
38147463Scael.Xr newfs 8 ,
38247463Scael.Xr mount 8 ,
38350906Smckusick.Xr mkfs 8 ,
38450906Smckusick.Xr rmt 8
38547463Scael.Sh BUGS
38647463Scael.Nm Restore
38718915Smckusickcan get confused when doing incremental restores from
388*69156Smckusickdumps that were made on active file systems.
38947463Scael.Pp
39018915SmckusickA level zero dump must be done after a full restore.
39118915SmckusickBecause restore runs in user code,
39218915Smckusickit has no control over inode allocation;
393*69156Smckusickthus a full dump must be done to get a new set of directories
39418915Smckusickreflecting the new inode numbering,
39518915Smckusickeven though the contents of the files is unchanged.
39647463Scael.Sh HISTORY
39747463ScaelThe
39850484Scael.Nm restore
39947463Scaelcommand appeared in
40047463Scael.Bx 4.2 .
401