]> git.wh0rd.org - dump.git/blame_incremental - restore/restore.8.in
Fix a problem in restore where the final \0 in the symbolic
[dump.git] / restore / restore.8.in
... / ...
CommitLineData
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. Neither the name of the University nor the names of its contributors
13.\" may be used to endorse or promote products derived from this software
14.\" without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\" $Id: restore.8.in,v 1.32 2004/07/13 08:17:32 stelian Exp $
29.\"
30.TH RESTORE 8 "version __VERSION__ of __DATE__" BSD "System management commands"
31.SH NAME
32restore \- restore files or file systems from backups made with dump
33.SH SYNOPSIS
34.B restore \-C
35[\fB\-cdklMvVy\fR]
36[\fB\-b \fIblocksize\fR]
37[\fB\-D \fIfilesystem\fR]
38[\fB\-f \fIfile\fR]
39[\fB\-F \fIscript\fR]
40[\fB\-L \fIlimit\fR]
41[\fB\-s \fIfileno\fR]
42[\fB\-T \fIdirectory\fR]
43.PP
44.B restore \-i
45[\fB\-acdhklmMNouvVy\fR]
46[\fB\-A \fIfile\fR]
47[\fB\-b \fIblocksize\fR]
48[\fB\-f \fIfile\fR]
49[\fB\-F \fIscript\fR]
50[\fB\-Q \fIfile\fR]
51[\fB\-s \fIfileno\fR]
52[\fB\-T \fIdirectory\fR]
53.PP
54.B restore \-P
55.I file
56[\fB\-acdhklmMNuvVy\fR]
57[\fB\-A \fIfile\fR]
58[\fB\-b \fIblocksize\fR]
59[\fB\-f \fIfile\fR]
60[\fB\-F \fIscript\fR]
61[\fB\-s \fIfileno\fR]
62[\fB\-T \fIdirectory\fR]
63[\fB\-X \fIfilelist\fR]
64[ \fIfile ... \fR]
65.PP
66.B restore \-R
67[\fB\-cdklMNuvVy\fR]
68[\fB\-b \fIblocksize\fR]
69[\fB\-f \fIfile\fR]
70[\fB\-F \fIscript\fR]
71[\fB\-s \fIfileno\fR]
72[\fB\-T \fIdirectory\fR]
73.PP
74.B restore \-r
75[\fB\-cdklMNuvVy\fR]
76[\fB\-b \fIblocksize\fR]
77[\fB\-f \fIfile\fR]
78[\fB\-F \fIscript\fR]
79[\fB\-s \fIfileno\fR]
80[\fB\-T \fIdirectory\fR]
81.PP
82.B restore \-t
83[\fB\-cdhklMNuvVy\fR]
84[\fB\-A \fIfile\fR]
85[\fB\-b \fIblocksize\fR]
86[\fB\-f \fIfile\fR]
87[\fB\-F \fIscript\fR]
88[\fB\-Q \fIfile\fR]
89[\fB\-s \fIfileno\fR]
90[\fB\-T \fIdirectory\fR]
91[\fB\-X \fIfilelist\fR]
92[ \fIfile ... \fR]
93.PP
94.B restore \-x
95[\fB\-adchklmMNouvVy\fR]
96[\fB\-A \fIfile\fR]
97[\fB\-b \fIblocksize\fR]
98[\fB\-f \fIfile\fR]
99[\fB\-F \fIscript\fR]
100[\fB\-Q \fIfile\fR]
101[\fB\-s \fIfileno\fR]
102[\fB\-T \fIdirectory\fR]
103[\fB\-X \fIfilelist\fR]
104[ \fIfile ... \fR]
105.SH DESCRIPTION
106The
107.B restore
108command performs the inverse function of
109.BR dump (8).
110A full backup of a file system may be restored and subsequent incremental
111backups layered on top of it. Single files and directory subtrees may be
112restored from full or partial backups.
113.B Restore
114works across a network; to do this see the
115.B \-f
116flag described below. Other arguments to the command are file or directory
117names specifying the files that are to be restored. Unless the
118.B \-h
119flag is specified (see below), the appearance of a directory name refers to
120the files and (recursively) subdirectories of that directory.
121.PP
122Exactly one of the following flags is required:
123.TP
124.B \-C
125This mode allows comparison of files from a dump.
126.B Restore
127reads the backup and compares its contents with files present on the disk. It
128first changes its working directory to the root of the filesystem that was
129dumped and compares the tape with the files in its new current directory. See
130also the
131.B \-L
132flag described below.
133.TP
134.B \-i
135This mode allows interactive restoration of files from a dump. After reading in
136the directory information from the dump,
137.B restore
138provides a shell like interface that allows the user to move around the
139directory tree selecting files to be extracted. The available commands are
140given below; for those commands that require an argument, the default is the
141current directory.
142.RS
143.TP
144.B add \fR[\fIarg\fR]
145The current directory or specified argument is added to the list of files to be
146extracted. If a directory is specified, then it and all its descendents are
147added to the extraction list (unless the
148.B \-h
149flag is specified on the command line). Files that are on the extraction list
150are prepended with a \*(lq*\*(rq when they are listed by
151.BR ls .
152.TP
153.BI cd " arg"
154Change the current working directory to the specified argument.
155.TP
156.B delete \fR[\fIarg\fR]
157The current directory or specified argument is deleted from the list of files
158to be extracted. If a directory is specified, then it and all its descendents
159are deleted from the extraction list (unless the
160.B \-h
161flag is specified on the command line). The most expedient way to extract most
162of the files from a directory is to add the directory to the extraction list
163and then delete those files that are not needed.
164.TP
165.B extract
166All files on the extraction list are extracted from the dump.
167.B Restore
168will ask which volume the user wishes to mount. The fastest way to extract a f
169ew files is to start with the last volume and work towards the first volume.
170.TP
171.B help
172List a summary of the available commands.
173.TP
174.B ls \fR[\fIarg\fR]
175List the current or specified directory. Entries that are directories are
176appended with a \*(lq/\*(rq. Entries that have been marked for extraction are
177prepended with a \*(lq*\*(rq. If the verbose flag is set, the inode number of
178each entry is also listed.
179.TP
180.B pwd
181Print the full pathname of the current working directory.
182.TP
183.B quit
184.B Restore
185immediately exits, even if the extraction list is not empty.
186.TP
187.B setmodes
188All directories that have been added to the extraction list have their owner,
189modes, and times set; nothing is extracted from the dump. This is useful for
190cleaning up after a
191.B restore
192has been prematurely aborted.
193.TP
194.B verbose
195The sense of the
196.B \-v
197flag is toggled. When set, the verbose flag causes the
198.B ls
199command to list the inode numbers of all entries. It also causes
200.B restore
201to print out information about each file as it is extracted.
202.RE
203.TP
204.BI \-P " file"
205.B Restore
206creates a new Quick File Access file
207.I file
208from an existing dump file without restoring its contents.
209.TP
210.B \-R
211.B Restore
212requests a particular tape of a multi-volume set on which to restart a full
213restore (see the
214.B \-r
215flag below). This is useful if the restore has been interrupted.
216.TP
217.B \-r
218Restore (rebuild) a file system. The target file system should be made pristine
219with
220.BR mke2fs (8),
221mounted, and the user
222.BR cd 'd
223into the pristine file system before starting the restoration of the initial
224level 0 backup. If the level 0 restores successfully, the
225.B \-r
226flag may be used to restore any necessary incremental backups on top of the
227level 0. The
228.B \-r
229flag precludes an interactive file extraction and can be detrimental to one's
230health (not to mention the disk) if not used carefully. An example:
231.IP
232.RS 14
233.B mke2fs /dev/sda1
234.TP
235.B mount /dev/sda1 /mnt
236.TP
237.B cd /mnt
238.TP
239.B restore rf /dev/st0
240.RE
241.IP
242Note that
243.B restore
244leaves a file
245.I restoresymtable
246in the root directory to pass information between incremental restore passes.
247This file should be removed when the last incremental has been restored.
248.IP
249.BR Restore ,
250in conjunction with
251.BR mke2fs (8)
252and
253.BR dump (8),
254may be used to modify file system parameters such as size or block size.
255.TP
256.B \-t
257The names of the specified files are listed if they occur on the backup. If no
258file argument is given, the root directory is listed, which results in the
259entire content of the backup being listed, unless the
260.B \-h
261flag has been specified. Note that the
262.B \-t
263flag replaces the function of the old
264.BR dumpdir (8)
265program. See also the
266.B \-X
267option below.
268.TP
269.B \-x
270The named files are read from the given media. If a named file matches a
271directory whose contents are on the backup and the
272.B \-h
273flag is not specified, the directory is recursively extracted. The owner,
274modification time, and mode are restored (if possible). If no file argument is
275given, the root directory is extracted, which results in the entire content of
276the backup being extracted, unless the
277.B \-h
278flag has been specified. See also the
279.B \-X
280option below.
281.SH OPTIONS
282The following additional options may be specified:
283.TP
284.B \-a
285In
286.B \-i
287or
288.B \-x
289mode,
290.B restore
291does ask the user for the volume number on which the files to be extracted are
292supposed to be (in order to minimise the time by reading only the interesting
293volumes). The
294.B \-a
295option disables this behaviour and reads all the volumes starting with 1. This
296option is useful when the operator does not know on which volume the files to
297be extracted are and/or when he prefers the longer unattended mode rather than
298the shorter interactive mode.
299.TP
300.BI \-A " archive_file"
301Read the table of contents from
302.I archive_file
303instead of the media. This option can be used in combination with the
304.BR \-t ,
305.BR \-i ,
306or
307.B \-x
308options, making it possible to check whether files are on the media without
309having to mount the media.
310.TP
311.BI \-b " blocksize"
312The number of kilobytes per dump record. If the
313.B \-b
314option is not specified,
315.B restore
316tries to determine the media block size dynamically.
317.TP
318.B \-c
319Normally,
320.B restore
321will try to determine dynamically whether the dump was made from an old
322(pre-4.4) or new format file system. The
323.B \-c
324flag disables this check, and only allows reading a dump in the old format.
325.TP
326.B \-d
327The
328.B \-d
329(debug) flag causes
330.B restore
331to print debug information.
332.TP
333.BI \-D " filesystem"
334The
335.B \-D
336flag allows the user to specify the filesystem name when using
337.B restore
338with the
339.B \-C
340option to check the backup.
341.TP
342.BI \-f " file"
343Read the backup from
344.IR file ;
345.I file
346may be a special device file like
347.I /dev/st0
348(a tape drive),
349.I /dev/sda1
350(a disk drive), an ordinary file, or
351.I \-
352(the standard input). If the name of the file is of the form
353.I host:file
354or
355.IR user@host:file ,
356.B restore
357reads from the named file on the remote host using
358.BR rmt (8).
359.TP
360.BI \-F " script"
361Run script at the beginning of each tape. The device name and the current
362volume number are passed on the command line. The script must return 0 if
363.B restore
364should continue without asking the user to change the tape, 1 if
365.B restore
366should continue but ask the user to change the tape. Any other exit code will
367cause
368.B restore
369to abort. For security reasons,
370.B restore
371reverts back to the real user ID and the real group ID before running the
372script.
373.TP
374.B \-h
375Extract the actual directory, rather than the files that it references. This
376prevents hierarchical restoration of complete subtrees from the dump.
377.TP
378.B \-k
379Use Kerberos authentication when contacting the remote tape server. (Only
380available if this options was enabled when
381.B restore
382was compiled.)
383.TP
384.B \-l
385When doing remote restores, assume the remote file is a regular file (instead
386of a tape device). If you're restoring a remote compressed file, you will need
387to specify this option or
388.B restore
389will fail to access it correctly.
390.TP
391.BI \-L " limit"
392The
393.B \-L
394flag allows the user to specify a maximal number of miscompares when using
395.B restore
396with the
397.B \-C
398option to check the backup. If this limit is reached,
399.B restore
400will abort with an error message. A value of 0 (the default value) disables
401the check.
402.TP
403.B \-m
404Extract by inode numbers rather than by file name. This is useful if only a few
405files are being extracted, and one wants to avoid regenerating the complete
406pathname to the file.
407.TP
408.B \-M
409Enables the multi-volume feature (for reading dumps made using the
410.B \-M
411option of dump). The name specified with
412.B \-f
413is treated as a prefix and
414.B restore
415tries to read in sequence from
416.I <prefix>001, <prefix>002
417etc.
418.TP
419.B \-N
420The
421.B \-N
422flag causes
423.B restore
424to perform a full execution as requested by one of
425.BR \-i ,
426.BR \-R ,
427.BR \-r ,
428.B t
429or
430.B x
431command without actually writing any file on disk.
432.TP
433.B \-o
434The
435.B \-o
436flag causes
437.B restore
438to automatically restore the current directory permissions without asking the
439operator whether to do so in one of
440.B \-i
441or
442.B \-x
443modes.
444.TP
445.BI \-Q " file"
446Use the file
447.I file
448in order to read tape position as stored using the dump Quick File Access mode,
449in one of
450.BR \-i ,
451.B \-x
452or
453.B \-t
454mode.
455.IP
456It is recommended to set up the st driver to return logical tape positions
457rather than physical before calling
458.B dump/restore
459with parameter
460.BR \-Q .
461Since not all tape devices support physical tape positions those tape devices
462return an error during
463.B dump/restore
464when the st driver is set to the default physical setting. Please see the
465.BR st (4)
466man page, option
467.B MTSETDRVBUFFER
468, or the
469.BR mt(1)
470man page, on how to set the driver to return logical tape positions.
471.IP
472Before calling
473.B restore
474with parameter
475.BR \-Q ,
476always make sure the st driver is set to return the same type of tape position
477used during the call to
478.BR dump .
479Otherwise
480.B restore
481may be confused.
482.IP
483This option can be used when restoring from local or remote tapes (see above)
484or from local or remote files.
485.TP
486.BI \-s " fileno"
487Read from the specified
488.I fileno
489on a multi-file tape. File numbering starts at 1.
490.TP
491.BI \-T " directory"
492The
493.B \-T
494flag allows the user to specify a directory to use for the storage of temporary
495files. The default value is
496.IR /tmp .
497This flag is most useful when restoring files after having booted from a
498floppy. There might be little or no space on the floppy filesystem, but another
499source of space might exist.
500.TP
501.B \-u
502When creating certain types of files,
503.B restore
504may generate a warning diagnostic if they already exist in the target
505directory. To prevent this, the
506.B \-u
507(unlink) flag causes
508.B restore
509to remove old entries before attempting to create new ones.
510.TP
511.B \-v
512Normally
513.B restore
514does its work silently. The
515.B \-v
516(verbose) flag causes it to type the name of each file it treats preceded by
517its file type.
518.TP
519.B \-V
520Enables reading multi-volume non-tape mediums like CDROMs.
521.TP
522.BI \-X " filelist"
523Read list of files to be listed or extracted from the text file
524.I filelist
525in addition to those specified on the command line. This can be used in
526conjunction with the
527.B \-t
528or
529.B \-x
530commands. The file
531.I filelist
532should contain file names separated by newlines.
533.I filelist
534may be an ordinary file or
535.I -
536(the standard input).
537.TP
538.B \-y
539Do not ask the user whether to abort the restore in the event of an error.
540Always try to skip over the bad block(s) and continue.
541.PP
542(The 4.3BSD option syntax is implemented for backward compatibility but is not
543documented here.)
544.SH DIAGNOSTICS
545Complains if it gets a read error. If
546.B y
547has been specified, or the user responds
548.BR y ,
549.B restore
550will attempt to continue the restore.
551.PP
552If a backup was made using more than one tape volume,
553.B restore
554will notify the user when it is time to mount the next volume. If the
555.B \-x
556or
557.B \-i
558flag has been specified,
559.B restore
560will also ask which volume the user wishes to mount. The fastest way to extract
561a few files is to start with the last volume, and work towards the first volume.
562.PP
563There are numerous consistency checks that can be listed by
564.BR restore .
565Most checks are self-explanatory or can \*(lqnever happen\*(rq. Common errors
566are given below:
567.TP
568.I Converting to new file system format
569A dump tape created from the old file system has been loaded. It is
570automatically converted to the new file system format.
571.TP
572.I <filename>: not found on tape
573The specified file name was listed in the tape directory, but was not found on
574the tape. This is caused by tape read errors while looking for the file, and
575from using a dump tape created on an active file system.
576.TP
577.I expected next file <inumber>, got <inumber>
578A file that was not listed in the directory showed up. This can occur when
579using a dump created on an active file system.
580.TP
581.I Incremental dump too low
582When doing an incremental restore, a dump that was written before the previous
583incremental dump, or that has too low an incremental level has been loaded.
584.TP
585.I Incremental dump too high
586When doing an incremental restore, a dump that does not begin its coverage
587where the previous incremental dump left off, or that has too high an
588incremental level has been loaded.
589.TP
590.I Tape read error while restoring <filename>
591.TP
592.I Tape read error while skipping over inode <inumber>
593.TP
594.I Tape read error while trying to resynchronize
595A tape (or other media) read error has occurred. If a file name is specified,
596its contents are probably partially wrong. If an inode is being skipped or the
597tape is trying to resynchronize, no extracted files have been corrupted, though
598files may not be found on the tape.
599.TP
600.I resync restore, skipped <num> blocks
601After a dump read error,
602.B restore
603may have to resynchronize itself. This message lists the number of blocks that
604were skipped over.
605.SH EXIT STATUS
606.B Restore
607exits with zero status on success. Tape errors are indicated with an exit code
608of 1.
609.PP
610When doing a comparison of files from a dump, an exit code of 2 indicates that
611some files were modified or deleted since the dump was made.
612.SH ENVIRONMENT
613If the following environment variable exists it will be utilized by
614.BR restore :
615.TP
616.B TAPE
617If no
618.B \-f
619option was specified,
620.B restore
621will use the device specified via
622.B TAPE
623as the dump device.
624.B TAPE
625may be of the form
626.IR tapename ,
627.I host:tapename
628or
629.IR user@host:tapename .
630.TP
631.B TMPDIR
632The directory given in
633.B TMPDIR
634will be used instead of
635.I /tmp
636to store temporary files.
637.TP
638.B RMT
639The environment variable
640.B RMT
641will be used to determine the pathname of the remote
642.BR rmt (8)
643program.
644.TP
645.B RSH
646.B Restore
647uses the contents of this variable to determine the name of the remote shell
648command to use when doing a network restore (rsh, ssh etc.). If this variable
649is not set,
650.BR rcmd (3)
651will be used, but only root will be able to do a network restore.
652.SH FILES
653.TP
654.I /dev/st0
655the default tape drive
656.TP
657.I /tmp/rstdir*
658file containing directories on the tape
659.TP
660.I /tmp/rstmode*
661owner, mode, and time stamps for directories
662.TP
663.I ./restoresymtable
664information passed between incremental restores
665.SH SEE ALSO
666.BR dump (8),
667.BR mount (8),
668.BR mke2fs (8),
669.BR rmt (8)
670.SH BUGS
671.B Restore
672can get confused when doing incremental restores from dumps that were made on
673active file systems.
674.PP
675A level 0 dump must be done after a full restore. Because
676.B restore
677runs in user code, it has no control over inode allocation; thus a full dump
678must be done to get a new set of directories reflecting the new inode
679numbering, even though the content of the files is unchanged.
680.PP
681The temporary files
682.I /tmp/rstdir*
683and
684.I /tmp/rstmode*
685are generated with a unique name based on the date of the dump and the process
686ID (see
687.BR mktemp (3) ),
688except when
689.B \-r
690or
691.B \-R
692is used. Because
693.B \-R
694allows you to restart a
695.B \-r
696operation that may have been interrupted, the temporary files should be the
697same across different processes. In all other cases, the files are unique
698because it is possible to have two different dumps started at the same time,
699and separate operations shouldn't conflict with each other.
700.PP
701To do a network restore, you have to run
702.B restore
703as root or use a remote shell replacement (see
704.B RSH
705variable). This is due to the previous security history of
706.B dump
707and
708.BR restore .
709(
710.B restore
711is written to be setuid root, but we are not certain all bugs are gone from the
712code - run setuid at your own risk.)
713.PP
714At the end of restores in
715.B \-i
716or
717.B \-x
718modes (unless
719.B \-o
720option is in use),
721.B restore
722will ask the operator whether to set the permissions on the current
723directory. If the operator confirms this action, the permissions
724on the directory from where
725.B restore
726was launched will be replaced by the permissions on the dumped root
727inode. Although this behaviour is not really a bug, it has proven itself
728to be confusing for many users, so it is recommended to answer 'no',
729unless you're performing a full restore and you do want to restore the
730permissions on '/'.
731.PP
732It should be underlined that because it runs in user code,
733.B restore
734, when run with the
735.B \-C
736option, sees the files as the kernel presents them, whereas
737.B dump
738sees all the files on a given filesystem. In particular, this
739can cause some confusion when comparing a dumped filesystem a part
740of which is hidden by a filesystem mounted on top of it.
741.SH AUTHOR
742The
743.B dump/restore
744backup suite was ported to Linux's Second Extended File System by Remy Card
745<card@Linux.EU.Org>. He maintained the initial versions of
746.B dump
747(up and including 0.4b4, released in january 1997).
748.PP
749Starting with 0.4b5, the new maintainer is Stelian Pop <stelian@popies.net>.
750.SH AVAILABILITY
751The
752.B dump/restore
753backup suite is available from <http://dump.sourceforge.net>
754.SH HISTORY
755The
756.B restore
757command appeared in 4.2BSD.