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