]> git.wh0rd.org - dump.git/blame - restore/restore.8.in
Added the -X option to restore (read names of files to be
[dump.git] / restore / restore.8.in
CommitLineData
1227625a
SP
1.\" Copyright (c) 1985, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
08db2b86 32.\" $Id: restore.8.in,v 1.8 2000/03/08 11:25:58 stelian Exp $
1227625a 33.\"
8d4197bb 34.Dd __DATE__
1227625a 35.Dt RESTORE 8
df9ae507 36.Os "restore __VERSION__"
1227625a
SP
37.Sh NAME
38.Nm restore
39.Nd "restore files or file systems from backups made with dump"
40.Sh SYNOPSIS
41.Nm restore
42.Fl C
dc7cb1e2 43.Op Fl ckMvy
1227625a
SP
44.Op Fl b Ar blocksize
45.Op Fl D Ar filesystem
46.Op Fl f Ar file
47.Op Fl s Ar fileno
48.Op Fl T Ar directory
49.Nm restore
50.Fl i
dc7cb1e2 51.Op Fl chkmMNuvy
1227625a
SP
52.Op Fl b Ar blocksize
53.Op Fl f Ar file
54.Op Fl s Ar fileno
55.Op Fl T Ar directory
56.Nm restore
57.Fl R
dc7cb1e2 58.Op Fl ckMNuvy
1227625a
SP
59.Op Fl b Ar blocksize
60.Op Fl f Ar file
61.Op Fl s Ar fileno
62.Op Fl T Ar directory
63.Nm restore
64.Fl r
dc7cb1e2 65.Op Fl ckMNuvy
1227625a
SP
66.Op Fl b Ar blocksize
67.Op Fl f Ar file
68.Op Fl s Ar fileno
69.Op Fl T Ar directory
70.Nm restore
71.Fl t
dc7cb1e2 72.Op Fl chkMNuvy
1227625a
SP
73.Op Fl b Ar blocksize
74.Op Fl f Ar file
75.Op Fl s Ar fileno
76.Op Fl T Ar directory
77.Op file ...
78.Nm restore
08db2b86
SP
79.Fl t
80.Op Fl chkMNuvy
81.Op Fl b Ar blocksize
82.Op Fl f Ar file
83.Op Fl s Ar fileno
84.Op Fl T Ar directory
85.Op Fl X Ar filelist
86.Nm restore
1227625a 87.Fl x
dc7cb1e2 88.Op Fl chkmMNuvy
1227625a
SP
89.Op Fl b Ar blocksize
90.Op Fl f Ar file
91.Op Fl s Ar fileno
92.Op Fl T Ar directory
93.Op file ...
08db2b86
SP
94.Nm restore
95.Fl x
96.Op Fl chkmMNuvy
97.Op Fl b Ar blocksize
98.Op Fl f Ar file
99.Op Fl s Ar fileno
100.Op Fl T Ar directory
101.Op Fl X Ar filelist
1227625a 102.Pp
8d4197bb 103.in
1227625a
SP
104(The
105.Bx 4.3
ddd2ef55 106option syntax is implemented for backward compatibility but
1227625a
SP
107is not documented here.)
108.Sh DESCRIPTION
109The
110.Nm restore
111command performs the inverse function of
112.Xr dump 8 .
113A full backup of a file system may be restored and
114subsequent incremental backups layered on top of it.
115Single files and
116directory subtrees may be restored from full or partial
117backups.
118.Nm Restore
119works across a network;
120to do this see the
121.Fl f
122flag described below.
123Other arguments to the command are file or directory
124names specifying the files that are to be restored.
125Unless the
126.Fl h
127flag is specified (see below),
128the appearance of a directory name refers to
129the files and (recursively) subdirectories of that directory.
130.Pp
131Exactly one of the following flags is required:
132.Bl -tag -width Ds
133.It Fl C
134This mode allows comparison of files from a dump.
135.Nm Restore
136reads the backup and compares its contents with files present on the
137disk.
138It first changes its working directory to the root of the filesystem
139that was dumped and compares the tape with the files in its new
140current directory.
141.It Fl i
142This mode allows interactive restoration of files from a dump.
143After reading in the directory information from the dump,
144.Nm restore
145provides a shell like interface that allows the user to move
146around the directory tree selecting files to be extracted.
147The available commands are given below;
148for those commands that require an argument,
149the default is the current directory.
150.Bl -tag -width Fl
151.It Ic add Op Ar arg
152The current directory or specified argument is added to the list of
153files to be extracted.
154If a directory is specified, then it and all its descendents are
155added to the extraction list
156(unless the
157.Fl h
158flag is specified on the command line).
ddd2ef55
SP
159Files that are on the extraction list are prepended with a
160.Dq \&*
1227625a
SP
161when they are listed by
162.Ic ls .
163.It Ic \&cd Ar arg
164Change the current working directory to the specified argument.
165.It Ic delete Op Ar arg
166The current directory or specified argument is deleted from the list of
167files to be extracted.
168If a directory is specified, then it and all its descendents are
169deleted from the extraction list
170(unless the
171.Fl h
172flag is specified on the command line).
173The most expedient way to extract most of the files from a directory
174is to add the directory to the extraction list and then delete
175those files that are not needed.
176.It Ic extract
ddd2ef55 177All files on the extraction list are extracted
1227625a
SP
178from the dump.
179.Nm Restore
180will ask which volume the user wishes to mount.
181The fastest way to extract a few files is to
ddd2ef55 182start with the last volume and work towards the first volume.
1227625a
SP
183.It Ic help
184List a summary of the available commands.
185.It Ic \&ls Op Ar arg
186List the current or specified directory.
ddd2ef55
SP
187Entries that are directories are appended with a
188.Dq \&* .
1227625a
SP
189Entries that have been marked for extraction are prepended with a ``*''.
190If the verbose
ddd2ef55 191flag is set, the inode number of each entry is also listed.
1227625a
SP
192.It Ic pwd
193Print the full pathname of the current working directory.
194.It Ic quit
195Restore immediately exits,
196even if the extraction list is not empty.
197.It Ic setmodes
ddd2ef55 198All directories that have been added to the extraction list
1227625a
SP
199have their owner, modes, and times set;
200nothing is extracted from the dump.
201This is useful for cleaning up after a restore has been prematurely aborted.
202.It Ic verbose
203The sense of the
204.Fl v
205flag is toggled.
206When set, the verbose flag causes the
207.Ic ls
208command to list the inode numbers of all entries.
209It also causes
210.Nm restore
211to print out information about each file as it is extracted.
212.El
213.It Fl R
214.Nm Restore
ddd2ef55 215requests a particular tape of a multi-volume set on which to restart
1227625a
SP
216a full restore
217(see the
218.Fl r
219flag below).
220This is useful if the restore has been interrupted.
221.It Fl r
ddd2ef55 222Restore (rebuild) a file system.
1227625a 223The target file system should be made pristine with
8d4197bb 224.Xr mke2fs 8 ,
ddd2ef55 225mounted, and the user
1227625a
SP
226.Xr cd Ns 'd
227into the pristine file system
228before starting the restoration of the initial level 0 backup. If the
229level 0 restores successfully, the
230.Fl r
231flag may be used to restore
232any necessary incremental backups on top of the level 0.
233The
234.Fl r
235flag precludes an interactive file extraction and can be
ddd2ef55
SP
236detrimental to one's health (not to mention the disk) if not used carefully.
237An example:
1227625a 238.Bd -literal -offset indent
8d4197bb
SP
239mke2fs /dev/sda1
240mount /dev/sda1 /mnt
1227625a
SP
241cd /mnt
242
8d4197bb 243restore rf /dev/st0
1227625a
SP
244.Ed
245.Pp
246Note that
247.Nm restore
248leaves a file
249.Pa restoresymtable
250in the root directory to pass information between incremental
251restore passes.
252This file should be removed when the last incremental has been
253restored.
254.Pp
255.Nm Restore ,
256in conjunction with
8d4197bb 257.Xr mke2fs 8
1227625a
SP
258and
259.Xr dump 8 ,
260may be used to modify file system parameters
261such as size or block size.
262.It Fl t
263The names of the specified files are listed if they occur
264on the backup.
265If no file argument is given,
ddd2ef55 266the root directory is listed,
1227625a
SP
267which results in the entire content of the
268backup being listed,
269unless the
270.Fl h
271flag has been specified.
272Note that the
273.Fl t
274flag replaces the function of the old
275.Xr dumpdir 8
276program.
08db2b86
SP
277See also the
278.Fl X
279option below.
1227625a
SP
280.ne 1i
281.It Fl x
282The named files are read from the given media.
283If a named file matches a directory whose contents
284are on the backup
285and the
286.Fl h
287flag is not specified,
288the directory is recursively extracted.
289The owner, modification time,
290and mode are restored (if possible).
291If no file argument is given,
ddd2ef55 292the root directory is extracted,
1227625a
SP
293which results in the entire content of the
294backup being extracted,
295unless the
296.Fl h
297flag has been specified.
08db2b86
SP
298See also the
299.Fl X
300option below.
1227625a
SP
301.El
302.Pp
303The following additional options may be specified:
304.Bl -tag -width Ds
305.It Fl b Ar blocksize
306The number of kilobytes per dump record.
307If the
308.Fl b
309option is not specified,
310.Nm restore
b45f51d6 311tries to determine the media block size dynamically.
1227625a
SP
312.It Fl c
313Normally,
314.Nm restore
315will try to determine dynamically whether the dump was made from an
b45f51d6 316old (pre-4.4) or new format file system. The
1227625a
SP
317.Fl c
318flag disables this check, and only allows reading a dump in the old
319format.
320.It Fl D Ar filesystem
321The
322.Fl D
323flag allows the user to specify the filesystem name when using
324.Nm restore
325with the
326.Fl C
327option to check the backup.
328.It Fl f Ar file
329Read the backup from
330.Ar file ;
331.Ar file
332may be a special device file
333like
ddd2ef55 334.Pa /dev/st0
1227625a 335(a tape drive),
8d4197bb 336.Pa /dev/sda1
1227625a
SP
337(a disk drive),
338an ordinary file,
339or
340.Ql Fl
341(the standard input).
342If the name of the file is of the form
ddd2ef55 343.Dq host:file
1227625a
SP
344or
345.Dq user@host:file ,
346.Nm restore
347reads from the named file on the remote host using
348.Xr rmt 8 .
349.Pp
b45f51d6
SP
350.It Fl k
351Use Kerberos authentication when contacting the remote tape server.
352(Only available if this options was enabled when
353.Nm restore
354was compiled.)
355.Pp
1227625a
SP
356.It Fl h
357Extract the actual directory,
358rather than the files that it references.
359This prevents hierarchical restoration of complete subtrees
360from the dump.
361.It Fl m
362Extract by inode numbers rather than by file name.
363This is useful if only a few files are being extracted,
364and one wants to avoid regenerating the complete pathname
365to the file.
dc7cb1e2
SP
366.It Fl M
367Enables the multi-volume feature (for reading dumps made using
368the
369.Fl M
370option of dump). The name specified with
371.Fl f
372is treated as a prefix and
373.Nm
374tries to read in sequence from <prefix>001, <prefix>002 etc.
1227625a
SP
375.It Fl N
376The
377.Fl N
378flag causes
dc7cb1e2
SP
379.Nm
380to only print file names. Files are not extracted.
1227625a
SP
381.It Fl s Ar fileno
382Read from the specified
383.Ar fileno
384on a multi-file tape.
385File numbering starts at 1.
386.It Fl T Ar directory
387The
388.Fl T
389flag allows the user to specify a directory to use for the storage of
390temporary files. The default value is /tmp. This flag is most useful
391when restoring files after having booted from a floppy. There might be little
392or no space on the floppy filesystem, but another source of space might exist.
b45f51d6
SP
393.It Fl u
394When creating certain types of files, restore may generate a warning
395diagnostic if they already exist in the target directory.
396To prevent this, the
397.Fl u
398(unlink) flag causes restore to remove old entries before attempting
399to create new ones.
1227625a
SP
400.It Fl v
401Normally
402.Nm restore
403does its work silently.
404The
405.Fl v
406(verbose)
407flag causes it to type the name of each file it treats
408preceded by its file type.
08db2b86
SP
409.It Fl X Ar filelist
410Get the list of the files to be listed or extracted from the text file
411.Ar filelist
412instead of reading them on the command line. This can be used in
413conjunction with the
414.Fl t
415or
416.Fl x
417commands. The file
418.Ar filelist
419should contain file names separated by newlines.
1227625a
SP
420.It Fl y
421Do not ask the user whether to abort the restore in the event of an error.
422Always try to skip over the bad block(s) and continue.
423.El
424.Sh DIAGNOSTICS
ddd2ef55 425Complains if it gets a read error.
1227625a
SP
426If
427.Fl y
428has been specified, or the user responds
429.Ql y ,
430.Nm restore
431will attempt to continue the restore.
432.Pp
433If a backup was made using more than one tape volume,
434.Nm restore
435will notify the user when it is time to mount the next volume.
436If the
437.Fl x
438or
439.Fl i
440flag has been specified,
441.Nm restore
442will also ask which volume the user wishes to mount.
443The fastest way to extract a few files is to
444start with the last volume, and work towards the first volume.
445.Pp
446There are numerous consistency checks that can be listed by
447.Nm restore .
ddd2ef55
SP
448Most checks are self-explanatory or can
449.Dq never happen .
1227625a
SP
450Common errors are given below.
451.Pp
452.Bl -tag -width Ds -compact
ddd2ef55 453.It Converting to new file system format
1227625a
SP
454A dump tape created from the old file system has been loaded.
455It is automatically converted to the new file system format.
456.Pp
457.It <filename>: not found on tape
458The specified file name was listed in the tape directory,
459but was not found on the tape.
460This is caused by tape read errors while looking for the file,
461and from using a dump tape created on an active file system.
462.Pp
463.It expected next file <inumber>, got <inumber>
464A file that was not listed in the directory showed up.
465This can occur when using a dump created on an active file system.
466.Pp
467.It Incremental dump too low
ddd2ef55 468When doing an incremental restore,
1227625a
SP
469a dump that was written before the previous incremental dump,
470or that has too low an incremental level has been loaded.
471.Pp
472.It Incremental dump too high
ddd2ef55 473When doing an incremental restore,
1227625a
SP
474a dump that does not begin its coverage where the previous incremental
475dump left off,
476or that has too high an incremental level has been loaded.
477.Pp
478.It Tape read error while restoring <filename>
479.It Tape read error while skipping over inode <inumber>
480.It Tape read error while trying to resynchronize
481A tape (or other media) read error has occurred.
482If a file name is specified,
ddd2ef55 483its contents are probably partially wrong.
1227625a 484If an inode is being skipped or the tape is trying to resynchronize,
ddd2ef55 485no extracted files have been corrupted,
1227625a
SP
486though files may not be found on the tape.
487.Pp
488.It resync restore, skipped <num> blocks
489After a dump read error,
490.Nm restore
491may have to resynchronize itself.
492This message lists the number of blocks that were skipped over.
493.El
b45f51d6 494.Sh ENVIRONMENT
ddd2ef55
SP
495If the following environment variable exists it will be utilized by
496.Nm restore :
497.Pp
498.Bl -tag -width "TMPDIR" -compact
b45f51d6
SP
499.It Ev TAPE
500If no -f option was specified,
501.Nm
502will use the device specified via
503.Ev TAPE
504as the dump device.
505.Ev TAPE
506may be of the form
507.Qq tapename ,
ddd2ef55 508.Qq host:tapename
b45f51d6
SP
509or
510.Qq user@host:tapename .
ddd2ef55
SP
511.It Ev TMPDIR
512The directory given in
513.Ev TMPDIR
514will be used
515instead of
516.Pa /tmp
517to store temporary files.
b45f51d6
SP
518.It Ev RMT
519The environment variable
520.Ev RMT
521will be used to determine the pathname of the remote
522.Xr rmt 8
523program.
0c62667d
SP
524.It Ev RSH
525.Nm Restore
526uses the contents of this variable to determine the name of the
527remote shell command to use when doing a network restore (rsh, ssh etc.).
528If this variable is not set,
529.Xr rcmd 3
530will be used, but only root will be able to do a network restore.
1227625a
SP
531.Sh FILES
532.Bl -tag -width "./restoresymtable" -compact
ddd2ef55 533.It Pa /dev/st0
1227625a
SP
534the default tape drive
535.It Pa /tmp/rstdir*
ddd2ef55 536file containing directories on the tape
1227625a 537.It Pa /tmp/rstmode*
ddd2ef55 538owner, mode, and time stamps for directories
1227625a 539.It Pa \&./restoresymtable
ddd2ef55 540information passed between incremental restores
1227625a
SP
541.El
542.Sh SEE ALSO
543.Xr dump 8 ,
1227625a 544.Xr mount 8 ,
8d4197bb 545.Xr mke2fs 8 ,
1227625a
SP
546.Xr rmt 8
547.Sh BUGS
548.Nm Restore
549can get confused when doing incremental restores from
550dumps that were made on active file systems.
551.Pp
ddd2ef55
SP
552A level 0 dump must be done after a full restore.
553Because
554.Nm restore
555runs in user code,
1227625a
SP
556it has no control over inode allocation;
557thus a full dump must be done to get a new set of directories
558reflecting the new inode numbering,
ddd2ef55
SP
559even though the content of the files is unchanged.
560.Pp
561The temporary files
562.Pa /tmp/rstdir*
563and
564.Pa /tmp/rstmode*
565are generated with a unique name based on the date of the dump
566and the process ID (see
567.Xr mktemp 3 ),
568except when
569.Fl r
570or
571.Fl R
572is used.
573Because
574.Fl R
575allows you to restart a
576.Fl r
577operation that may have been interrupted, the temporary files should
578be the same across different processes.
579In all other cases, the files are unique because it is possible to
580have two different dumps started at the same time, and separate
581operations shouldn't conflict with each other.
b45f51d6 582.Pp
0c62667d
SP
583To do a network restore, you have to run restore as root or use
584a remote shell replacement (see RSH variable). This is due
b45f51d6
SP
585to the previous security history of dump and restore. (restore is
586written to be setuid root, but we are not certain all bugs are gone
587from the restore code - run setuid at your own risk.)
8d4197bb
SP
588.Sh AUTHOR
589The
590.Nm dump/restore
591backup suit was ported to Linux's Second Extended File System
592by Remy Card <card@Linux.EU.Org>. He maintained the initial versions
593of dump (up and including 0.4b4, released in january 1997).
594.Pp
595Starting with 0.4b5, the new maintainer is Stelian Pop
596.br
597<pop@cybercable.fr>.
598.Sh AVAILABILITY
599The
600.Nm dump/restore
01fb6bd5
SP
601backup suit is available from
602.br
603http://dump.sourceforge.net
1227625a
SP
604.Sh HISTORY
605The
606.Nm restore
607command appeared in
608.Bx 4.2 .