]> git.wh0rd.org - dump.git/blame - restore/restore.8.in
Added -F script option to restore.
[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.\"
c534413c 32.\" $Id: restore.8.in,v 1.15 2001/07/18 12:54:06 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
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
dc7cb1e2 52.Op Fl chkmMNuvy
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
dc7cb1e2 61.Op Fl ckMNuvy
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
dc7cb1e2 69.Op Fl ckMNuvy
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
dc7cb1e2 77.Op Fl chkMNuvy
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
88.Op Fl chkmMNuvy
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.
1227625a
SP
396.It Fl s Ar fileno
397Read from the specified
398.Ar fileno
399on a multi-file tape.
400File numbering starts at 1.
401.It Fl T Ar directory
402The
403.Fl T
404flag allows the user to specify a directory to use for the storage of
405temporary files. The default value is /tmp. This flag is most useful
406when restoring files after having booted from a floppy. There might be little
407or no space on the floppy filesystem, but another source of space might exist.
b45f51d6
SP
408.It Fl u
409When creating certain types of files, restore may generate a warning
410diagnostic if they already exist in the target directory.
411To prevent this, the
412.Fl u
413(unlink) flag causes restore to remove old entries before attempting
414to create new ones.
1227625a
SP
415.It Fl v
416Normally
417.Nm restore
418does its work silently.
419The
420.Fl v
421(verbose)
422flag causes it to type the name of each file it treats
423preceded by its file type.
08db2b86 424.It Fl X Ar filelist
1a05d45d 425Read list of files to be listed or extracted from the text file
08db2b86 426.Ar filelist
1a05d45d 427in addition to those specified on the command line. This can be used in
08db2b86
SP
428conjunction with the
429.Fl t
430or
431.Fl x
432commands. The file
433.Ar filelist
434should contain file names separated by newlines.
1a05d45d
SP
435.Ar filelist
436may be an ordinary file or
437.Ql Fl
438(the standard input).
1227625a
SP
439.It Fl y
440Do not ask the user whether to abort the restore in the event of an error.
441Always try to skip over the bad block(s) and continue.
442.El
443.Sh DIAGNOSTICS
ddd2ef55 444Complains if it gets a read error.
1227625a
SP
445If
446.Fl y
447has been specified, or the user responds
448.Ql y ,
449.Nm restore
450will attempt to continue the restore.
451.Pp
452If a backup was made using more than one tape volume,
453.Nm restore
454will notify the user when it is time to mount the next volume.
455If the
456.Fl x
457or
458.Fl i
459flag has been specified,
460.Nm restore
461will also ask which volume the user wishes to mount.
462The fastest way to extract a few files is to
463start with the last volume, and work towards the first volume.
464.Pp
465There are numerous consistency checks that can be listed by
466.Nm restore .
ddd2ef55
SP
467Most checks are self-explanatory or can
468.Dq never happen .
1227625a
SP
469Common errors are given below.
470.Pp
471.Bl -tag -width Ds -compact
ddd2ef55 472.It Converting to new file system format
1227625a
SP
473A dump tape created from the old file system has been loaded.
474It is automatically converted to the new file system format.
475.Pp
476.It <filename>: not found on tape
477The specified file name was listed in the tape directory,
478but was not found on the tape.
479This is caused by tape read errors while looking for the file,
480and from using a dump tape created on an active file system.
481.Pp
482.It expected next file <inumber>, got <inumber>
483A file that was not listed in the directory showed up.
484This can occur when using a dump created on an active file system.
485.Pp
486.It Incremental dump too low
ddd2ef55 487When doing an incremental restore,
1227625a
SP
488a dump that was written before the previous incremental dump,
489or that has too low an incremental level has been loaded.
490.Pp
491.It Incremental dump too high
ddd2ef55 492When doing an incremental restore,
1227625a
SP
493a dump that does not begin its coverage where the previous incremental
494dump left off,
495or that has too high an incremental level has been loaded.
496.Pp
497.It Tape read error while restoring <filename>
498.It Tape read error while skipping over inode <inumber>
499.It Tape read error while trying to resynchronize
500A tape (or other media) read error has occurred.
501If a file name is specified,
ddd2ef55 502its contents are probably partially wrong.
1227625a 503If an inode is being skipped or the tape is trying to resynchronize,
ddd2ef55 504no extracted files have been corrupted,
1227625a
SP
505though files may not be found on the tape.
506.Pp
507.It resync restore, skipped <num> blocks
508After a dump read error,
509.Nm restore
510may have to resynchronize itself.
511This message lists the number of blocks that were skipped over.
512.El
3d78f5f2
SP
513.Pp
514.Nm Restore
515exits with zero status on success.
516Tape errors are indicated with an exit code of 1.
517.Pp
518When doing a comparison of files from a dump, an exit code
519of 2 indicates that some files were modified or deleted since
520the dump was made.
b45f51d6 521.Sh ENVIRONMENT
ddd2ef55
SP
522If the following environment variable exists it will be utilized by
523.Nm restore :
524.Pp
525.Bl -tag -width "TMPDIR" -compact
b45f51d6
SP
526.It Ev TAPE
527If no -f option was specified,
528.Nm
529will use the device specified via
530.Ev TAPE
531as the dump device.
532.Ev TAPE
533may be of the form
534.Qq tapename ,
ddd2ef55 535.Qq host:tapename
b45f51d6
SP
536or
537.Qq user@host:tapename .
ddd2ef55
SP
538.It Ev TMPDIR
539The directory given in
540.Ev TMPDIR
541will be used
542instead of
543.Pa /tmp
544to store temporary files.
b45f51d6
SP
545.It Ev RMT
546The environment variable
547.Ev RMT
548will be used to determine the pathname of the remote
549.Xr rmt 8
550program.
0c62667d
SP
551.It Ev RSH
552.Nm Restore
553uses the contents of this variable to determine the name of the
554remote shell command to use when doing a network restore (rsh, ssh etc.).
555If this variable is not set,
556.Xr rcmd 3
557will be used, but only root will be able to do a network restore.
1227625a
SP
558.Sh FILES
559.Bl -tag -width "./restoresymtable" -compact
ddd2ef55 560.It Pa /dev/st0
1227625a
SP
561the default tape drive
562.It Pa /tmp/rstdir*
ddd2ef55 563file containing directories on the tape
1227625a 564.It Pa /tmp/rstmode*
ddd2ef55 565owner, mode, and time stamps for directories
1227625a 566.It Pa \&./restoresymtable
ddd2ef55 567information passed between incremental restores
1227625a
SP
568.El
569.Sh SEE ALSO
570.Xr dump 8 ,
1227625a 571.Xr mount 8 ,
8d4197bb 572.Xr mke2fs 8 ,
1227625a
SP
573.Xr rmt 8
574.Sh BUGS
575.Nm Restore
576can get confused when doing incremental restores from
577dumps that were made on active file systems.
578.Pp
ddd2ef55
SP
579A level 0 dump must be done after a full restore.
580Because
581.Nm restore
582runs in user code,
1227625a
SP
583it has no control over inode allocation;
584thus a full dump must be done to get a new set of directories
585reflecting the new inode numbering,
ddd2ef55
SP
586even though the content of the files is unchanged.
587.Pp
588The temporary files
589.Pa /tmp/rstdir*
590and
591.Pa /tmp/rstmode*
592are generated with a unique name based on the date of the dump
593and the process ID (see
594.Xr mktemp 3 ),
595except when
596.Fl r
597or
598.Fl R
599is used.
600Because
601.Fl R
602allows you to restart a
603.Fl r
604operation that may have been interrupted, the temporary files should
605be the same across different processes.
606In all other cases, the files are unique because it is possible to
607have two different dumps started at the same time, and separate
608operations shouldn't conflict with each other.
b45f51d6 609.Pp
0c62667d
SP
610To do a network restore, you have to run restore as root or use
611a remote shell replacement (see RSH variable). This is due
b45f51d6
SP
612to the previous security history of dump and restore. (restore is
613written to be setuid root, but we are not certain all bugs are gone
614from the restore code - run setuid at your own risk.)
8d4197bb
SP
615.Sh AUTHOR
616The
617.Nm dump/restore
7422942f 618backup suite was ported to Linux's Second Extended File System
8d4197bb
SP
619by Remy Card <card@Linux.EU.Org>. He maintained the initial versions
620of dump (up and including 0.4b4, released in january 1997).
621.Pp
622Starting with 0.4b5, the new maintainer is Stelian Pop
623.br
109e9e1d 624<pop@noos.fr>.
8d4197bb
SP
625.Sh AVAILABILITY
626The
627.Nm dump/restore
7422942f 628backup suite is available from
01fb6bd5
SP
629.br
630http://dump.sourceforge.net
1227625a
SP
631.Sh HISTORY
632The
633.Nm restore
634command appeared in
635.Bx 4.2 .