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