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