6324 Add an `ndp' tool for manipulating the neighbors table
[illumos-gate.git] / usr / src / man / man1m / ufsrestore.1m
blob22a74d6ecd788f1db53c8b6dfce738c4d205dbe8
1 '\" te
2 .\" Copyright (c) 2002 Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH UFSRESTORE 1M "Sep 24, 2002"
8 .SH NAME
9 ufsrestore \- incremental file system restore
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fB/usr/sbin/ufsrestore\fR i | r | R | t | x [abcdfhlmostvyLT]
14      [\fIarchive_file\fR] [\fIfactor\fR] [\fIdumpfile\fR] [\fIn\fR] [\fIlabel\fR]
15      [\fItimeout\fR] [\fIfilename\fR]...
16 .fi
18 .SH DESCRIPTION
19 .sp
20 .LP
21 The \fBufsrestore\fR utility restores files from backup media created with the
22 \fBufsdump\fR command. \fBufsrestores\fR's actions are controlled by the
23 \fIkey\fR argument. The \fIkey\fR is exactly one \fBfunction\fR \fIletter\fR
24 (\fBi\fR, \fBr\fR, \fBR\fR , \fBt\fR, or \fBx\fR) and zero or more \fIfunction
25 modifier\fRs (letters). The \fIkey\fR string contains no \fBSPACE\fR
26 characters. Function modifier arguments are listed on the command line in the
27 same order as their corresponding function modifiers appear in the \fIkey\fR
28 string.
29 .sp
30 .LP
31 \fIfilename\fR arguments which appear on the command line, or as arguments to
32 an interactive command, are treated as shell \fBglob\fR patterns by the \fBx\fR
33 and \fBt\fR functions; any files or directories matching the patterns are
34 selected. The metacharacters \fB*\fR, \fB?\fR, and \fB[ ]\fR must be protected
35 from the shell if they appear on the command line. There is no way to quote
36 these metacharacters to explicitly match them in a filename.
37 .sp
38 .LP
39 The temporary files \fBrstdir*\fR and \fBrstmode*\fR are placed in \fB/tmp\fR
40 by default. If the environment variable \fBTMPDIR\fR is defined with a
41 non-empty value, that location is used instead of \fB/tmp\fR.
42 .SH OPTIONS
43 .SS "Function Letters"
44 .sp
45 .LP
46 You must specify one (and only one) of the function letters listed below. Note
47 that \fBi\fR, \fBx\fR, and \fBr\fR are intended to restore files into an empty
48 directory. The \fBR\fR function is intended for restoring into a populated
49 directory.
50 .sp
51 .ne 2
52 .na
53 \fB\fBi\fR\fR
54 .ad
55 .RS 5n
56 Interactive. After reading in the directory information from the media,
57 \fBufsrestore\fR invokes a shell-like interface that allows you to browse
58 through the dump file's directory hierarchy and select individual files to be
59 extracted. Restoration has the same semantics as \fBx\fR (see below). See
60 \fBInteractive Commands\fR, below, for a description of available commands.
61 .RE
63 .sp
64 .ne 2
65 .na
66 \fBr\fR
67 .ad
68 .RS 5n
69 Recursive. Starting with an empty directory and a level 0 dump, the \fBr\fR
70 function recreates the filesystem relative to the current working directory,
71 exactly as it appeared when the dump was made. Information used to restore
72 incremental dumps on top of the full dump (for example, \fBrestoresymtable\fR)
73 is also included. Several \fBufsrestore\fR runs are typical, one for each
74 higher level of dump (0, 1, ..., 9).  Files that were deleted between the level
75 0 and a subsequent incremental dump will not exist after the final restore. To
76 completely restore a file system, use the \fBr\fR function restore the level 0
77 dump, and again for each incremental dump. Although  this function letter is
78 intended for a complete restore onto a new file system (one just created with
79 \fBnewfs\fR(1M)), if the file  system contains files not on the backup media,
80 they are preserved.
81 .RE
83 .sp
84 .ne 2
85 .na
86 \fBR\fR
87 .ad
88 .RS 5n
89 Resume restoring. If an \fBr\fR-mode \fBufsrestore\fR was interrupted, this
90 function prompts for the volume from which to resume restoring and continues
91 the restoration from where it was left off.  Otherwise identical to \fBr\fR.
92 .RE
94 .sp
95 .ne 2
96 .na
97 \fBt\fR
98 .ad
99 .RS 5n
100 Table of contents. List each \fIfilename\fR that appears on the media. If no
101 \fIfilename\fR argument is given, the root directory is listed. This results in
102 a list of all files on the media, unless the \fBh\fR function modifier is in
103 effect. The table of contents is taken from the media or from the specified
104 archive file, when the \fBa\fR function modifier is used. The \fBa\fR function
105 modifier is mutually exclusive with the \fBx\fR and \fBr\fR function letters.
109 .ne 2
111 \fBx\fR
113 .RS 5n
114 Extract the named files from the media. Files are restored to the same relative
115 locations that they had in the original file system.
117 If the \fIfilename\fR argument matches a directory whose contents were written
118 onto the media, and the \fBh\fR modifier is not in effect, the directory is
119 recursively extracted, relative to the current directory, which is expected to
120 be empty. For each file, the owner, modification time, and mode are restored
121 (if possible).
123 If you omit the \fIfilename\fR argument or specify \fB\&.\fR, the root
124 directory is extracted. This results in the entire tape being extracted, unless
125 the \fBh\fR modifier is in effect. . With the \fBx\fR function, existing files
126 are overwritten and \fBufsrestore\fR displays the names of the overwritten
127 files. Overwriting a currently-running executable can have unfortunate
128 consequences.
130 Use the \fBx\fR option to restore partial file system dumps, as they are (by
131 definition) not entire file systems.
134 .SS "Function Modifiers"
136 .ne 2
138 \fBa \fIarchive_file\fR\fR
140 .RS 19n
141 Read the table of contents from \fIarchive_file\fR instead of the media. This
142 function modifier can be used in combination with the \fBt\fR, \fBi\fR, or
143 \fBx\fR function letters, making it possible to check whether files are on the
144 media without having to mount the media. When used with the \fBx\fR and
145 interactive (\fBi\fR) function letters, it prompts for the volume containing
146 the file(s) before extracting them.
150 .ne 2
152 \fBb \fIfactor\fR\fR
154 .RS 19n
155 Blocking factor. Specify the blocking factor for tape reads. For variable
156 length \fBSCSI\fR tape devices, unless the data was written with the default
157 blocking factor, a blocking factor at least as great as that used to write the
158 tape must be used; otherwise, an error will be generated. Note that a tape
159 block is 512 bytes. Refer to the man page for your specific tape driver for the
160 maximum blocking factor.
164 .ne 2
166 \fBc\fR
168 .RS 19n
169 Convert the contents of the media in 4.1BSD format to the new \fBufs\fR file
170 system format.
174 .ne 2
176 \fBd\fR
178 .RS 19n
179 Debug. Turn on debugging output.
183 .ne 2
185 \fBf \fIdump_file\fR\fR
187 .RS 19n
188 Use \fIdump_file\fR instead of \fB/dev/rmt/0\fR as the file to restore from.
189 Typically \fIdump_file\fR specifies a tape or diskette drive. If
190 \fIdump_file\fR is specified as `\fB\(mi\fR\&', \fBufsrestore\fR reads from the
191 standard input. This allows \fBufsdump\fR(1M) and \fBufsrestore\fR to be used
192 in a pipeline to copy a file system:
194 .in +2
196 example# ufsdump 0f \(mi /dev/rdsk/c0t0d0s7 \e
197  | (cd /home;ufsrestore xf \(mi)
199 .in -2
202 If the name of the file is of the form \fImachine\fR\fB:\fR\fIdevice\fR, the
203 restore is done from the specified machine over the network using
204 \fBrmt\fR(1M). Since \fBufsrestore\fR is normally run by root, the name of the
205 local machine must appear in the \fB/.rhosts\fR file of the remote machine. If
206 the file is specified as \fIuser\fR\fB@\fR\fImachine\fR\fB:\fR\fIdevice\fR,
207 \fBufsrestore\fR will attempt to execute as the specified user on the remote
208 machine. The specified user must have a \fB\&.rhosts\fR file on the remote
209 machine that allows the user invoking the command from the local machine to
210 access the remote machine.
214 .ne 2
216 \fBh\fR
218 .RS 19n
219 Extract or list the actual directory, rather than the files that it references.
220 This prevents hierarchical restoration of complete subtrees from the tape.
224 .ne 2
226 \fBl\fR
228 .RS 19n
229 Autoload. When the end-of-tape is reached before the restore is complete, take
230 the drive off-line and wait up to two minutes (the default, see the \fBT\fR
231 function modifier) for the tape drive to be ready again. This gives autoloading
232 (stackloader) tape drives a chance to load a new tape. If the drive is ready
233 within two minutes, continue. If it is not, prompt for another tape and wait.
237 .ne 2
239 \fBL \fIlabel\fR\fR
241 .RS 19n
242 The label that should appear in the header of the dump file. If the labels do
243 not match, \fBufsrestore\fR issues a diagnostic and exits. The tape label is
244 specific to the \fBufsdump\fR tape format, and bears no resemblance to
245 \fBIBM\fR or \fBANSI\fR-standard tape labels.
249 .ne 2
251 \fBm\fR
253 .RS 19n
254 Extract by inode numbers rather than by filename to avoid regenerating complete
255 pathnames. Regardless of where the files are located in the dump hierarchy,
256 they are restored into the current directory and renamed with their inode
257 number. This is useful if only a few files are being extracted.
261 .ne 2
263 \fBo\fR
265 .RS 19n
266 Offline. Take the drive off-line when the restore is complete or the
267 end-of-media is reached and rewind the tape, or eject the diskette. In the case
268 of some autoloading 8mm drives, the tape is removed from the drive
269 automatically.
273 .ne 2
275 \fBs \fIn\fR\fR
277 .RS 19n
278 Skip to the \fIn\fRth file when there are multiple dump files on the same tape.
279 For example, the command:
281 .in +2
283 example# ufsrestore xfs /dev/rmt/0hn 5
285 .in -2
288 would position you to the fifth file on the tape when reading volume 1 of the
289 dump. If a dump extends over more than one volume, all volumes except the first
290 are assumed to start at position 0, no matter what "\fBs\fR \fIn\fR" value is
291 specified.
293 If "\fBs\fR \fIn\fR" is specified, the backup media must be at \fBBOT\fR
294 (beginning of tape). Otherwise, the initial positioning to read the table of
295 contents will fail, as it is performed by skipping the tape forward
296 \fIn\fR\fB-1\fR files rather than by using absolute positioning. This is
297 because on some devices absolute positioning is very time consuming.
301 .ne 2
303 \fBT timeout [hms]\fR
305 .RS 19n
306 Sets the amount of time to wait for an autoload command to complete. This
307 function modifier is ignored unless the \fBl\fR function modifier has also been
308 specified. The default timeout period is two minutes. The time units may be
309 specified as a trailing \fBh\fR (hours), \fBm\fR (minutes), or \fBs\fR
310 (seconds). The default unit is minutes.
314 .ne 2
316 \fBv\fR
318 .RS 19n
319 Verbose. \fBufsrestore\fR displays the name and inode number of each file it
320 restores, preceded by its file type.
324 .ne 2
326 \fBy\fR
328 .RS 19n
329 Do not ask whether to abort the restore in the event of tape errors.
330 \fBufsrestore\fR tries to skip over the bad tape block(s) and continue as best
331 it can.
334 .SS "Interactive Commands"
337 \fBufsrestore\fR enters interactive mode when invoked with the \fBi\fR function
338 letters. Interactive commands are reminiscent of the shell. For those commands
339 that accept an argument, the default is the current directory. The interactive
340 options are:
342 .ne 2
344 \fBadd [\fIfilename\fR]\fR
346 .RS 22n
347 Add the named file or directory to the list of files to extract. If a directory
348 is specified, add that directory and its files (recursively) to the extraction
349 list (unless the \fBh\fR modifier is in effect).
353 .ne 2
355 \fBcd \fIdirectory\fR\fR
357 .RS 22n
358 Change to \fIdirectory\fR (within the dump file).
362 .ne 2
364 \fBdelete [\fIfilename\fR]\fR
366 .RS 22n
367 Delete the current directory, or the named file or directory from the list of
368 files to extract. If a directory is specified, delete that directory and all
369 its descendents from the extraction list (unless the \fBh\fR modifier is in
370 effect). The most expedient way to extract a majority of files from a directory
371 is to add that directory to the extraction list, and then delete specific files
372 to omit.
376 .ne 2
378 \fBextract\fR
380 .RS 22n
381 Extract all files on the extraction list from the dump media. \fBufsrestore\fR
382 asks which volume the user wishes to mount. The fastest way to extract a small
383 number of files is to start with the last volume and work toward the first. If
384 "\fBs\fR \fIn\fR" is given on the command line, volume 1 will automatically be
385 positioned to file \fIn\fR when it is read.
389 .ne 2
391 \fBhelp\fR
393 .RS 22n
394 Display a summary of the available commands.
398 .ne 2
400 \fBls [\fIdirectory\fR]\fR
402 .RS 22n
403 List files in \fIdirectory\fR or the current directory, represented by a
404 `\fB\&.\fR' (period). Directories are appended with a `\fB/\fR' (slash).
405 Entries marked for extraction are prefixed with a `\fB*\fR' (asterisk). If the
406 verbose option is in effect, inode numbers are also listed.
410 .ne 2
412 \fBmarked [\fIdirectory\fR]\fR
414 .RS 22n
415 Like \fBls\fR, except only files marked for extraction are listed.
419 .ne 2
421 \fBpager\fR
423 .RS 22n
424 Toggle the pagination of the output from the \fBls\fR and \fBmarked\fR
425 commands. The pager used is that defined by the \fBPAGER\fR environment
426 variable, or more(1) if that envar is not defined. The \fBPAGER\fR envar may
427 include white-space-separated arguments for the pagination program.
431 .ne 2
433 \fBpwd\fR
435 .RS 22n
436 Print the full pathname of the current working directory.
440 .ne 2
442 \fBquit\fR
444 .RS 22n
445 \fBufsrestore\fR exits immediately, even if the extraction list is not empty.
449 .ne 2
451 \fBsetmodes\fR
453 .RS 22n
454 Prompts: \fBset owner/mode for\fR `\fB\&.\fR' (period). Type \fBy\fR for yes to
455 set the mode (permissions, owner, times) of the current directory `\fB\&.\fR'
456 (period) into which files are being restored equal to the mode of the root
457 directory of the file system from which they were dumped. Normally, this is
458 what you want when restoring a whole file system, or restoring individual files
459 into the same locations from which they were dumped. Type \fBn\fR for no, to
460 leave the mode of the current directory unchanged. Normally, this is what you
461 want when restoring part of a dump to a directory other than the one from which
462 the files were dumped.
466 .ne 2
468 \fBsetpager \fIcommand\fR\fR
470 .RS 22n
471 Sets the command to use for paginating output instead of the default or that
472 inherited from the environment. The \fIcommand\fR string may include arguments
473 in addition to the command itself.
477 .ne 2
479 \fBverbose\fR
481 .RS 22n
482 Toggle the status of the \fBv\fR modifier. While \fBv\fR is in effect, the
483 \fBls\fR command lists the inode numbers of all entries, and \fBufsrestore\fR
484 displays information about each file as it is extracted.
488 .ne 2
490 \fBwhat\fR
492 .RS 22n
493 Display the dump header on the media.
496 .SH OPERANDS
499 The following operands are supported.
501 .ne 2
503 \fB\fIfilename\fR\fR
505 .RS 12n
506 Specifies the pathname of files (or directories) to be restored to disk. Unless
507 the \fBh\fR function modifier is also used, a directory name refers to the
508 files it contains, and (recursively) its subdirectories and the files they
509 contain. \fIfilename\fR is associated with either the \fBx\fR or \fBt\fR
510 function letters, and must come last.
513 .SH USAGE
516 See \fBlargefile\fR(5) for the description of the behavior of \fBufsrestore\fR
517 when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
518 .SH EXIT STATUS
521 The following exit values are returned:
523 .ne 2
525 \fB\fB0\fR\fR
527 .RS 5n
528 Successful completion.
532 .ne 2
534 \fB\fB1\fR\fR
536 .RS 5n
537 An error occurred. Verbose messages are displayed.
540 .SH ENVIRONMENT VARIABLES
542 .ne 2
544 \fBPAGER\fR
546 .RS 10n
547 The command to use as a filter for paginating output. This can also be used to
548 specify the options to be used. Default is \fBmore\fR(1).
552 .ne 2
554 \fBTMPDIR\fR
556 .RS 10n
557 Selects the directory for temporary files. Defaults to \fB/tmp\fR if not
558 defined in the environment.
561 .SH FILES
563 .ne 2
565 \fB\fB/dev/rmt/0\fR\fR
567 .RS 23n
568 the default tape drive
572 .ne 2
574 \fB\fB$TMPDIR/rstdir*\fR\fR
576 .RS 23n
577 file containing directories on the tape
581 .ne 2
583 \fB\fB$TMPDIR/rstmode*\fR\fR
585 .RS 23n
586 owner, mode, and timestamps for directories
590 .ne 2
592 \fB\fB\&./restoresymtable\fR\fR
594 .RS 23n
595 information passed between incremental restores
598 .SH SEE ALSO
601 \fBmore\fR(1), \fBmkfs\fR(1M), \fBmount\fR(1M), \fBrmt\fR(1M),
602 \fBufsdump\fR(1M), \fBufsdump\fR(4), \fBattributes\fR(5), \fBlargefile\fR(5)
603 .SH DIAGNOSTICS
606 \fBufsrestore\fR complains about bad option characters.
609 Read errors result in complaints. If \fBy\fR has been specified, or the user
610 responds \fBy\fR, \fBufsrestore\fR will attempt to continue.
613 If the dump extends over more than one tape, \fBufsrestore\fR asks the user to
614 change tapes. If the \fBx\fR or \fBi\fR function letter has been specified,
615 \fBufsrestore\fR also asks which volume the user wishes to mount. If the
616 \fBs\fR modifier has been specified, and volume 1 is mounted, it is
617 automatically positioned to the indicated file.
620 There are numerous consistency checks that can be listed by \fBufsrestore\fR.
621 Most checks are self-explanatory or can "never happen". Common errors are given
622 below.
624 .ne 2
626 \fB\fBConverting to new file system format\fR\fR
628 .sp .6
629 .RS 4n
630 A dump tape created from the old file system has been loaded. It is
631 automatically converted to the new file system format.
635 .ne 2
637 \fB\fIfilename\fR\fB: not found on tape\fR\fR
639 .sp .6
640 .RS 4n
641 The specified file name was listed in the tape directory, but was not found on
642 the tape. This is caused by tape read errors while looking for the file, using
643 a dump tape created on an active file system, or restoring a partial dump with
644 the \fBr\fR function.
648 .ne 2
650 \fB\fBexpected next file\fR \fIinumber\fR\fB, got\fR \fIinumber\fR\fR
652 .sp .6
653 .RS 4n
654 A file that was not listed in the directory showed up. This can occur when
655 using a dump tape created on an active file system.
659 .ne 2
661 \fB\fBIncremental tape too low\fR\fR
663 .sp .6
664 .RS 4n
665 When doing an incremental restore, a tape that was written before the previous
666 incremental tape, or that has too low an incremental level has been loaded.
670 .ne 2
672 \fB\fBIncremental tape too high\fR\fR
674 .sp .6
675 .RS 4n
676 When doing incremental restore, a tape that does not begin its coverage where
677 the previous incremental tape left off, or one that has too high an incremental
678 level has been loaded.
682 .ne 2
684 \fB\fBmedia\fR \fBread\fR \fBerror:\fR \fBinvalid\fR \fBargument\fR\fR
686 .sp .6
687 .RS 4n
688 Blocking factor specified for read is smaller than the blocking factor used to
689 write data.
693 .ne 2
695 \fB\fBTape read error while restoring\fR\fR
699 \fB\fBTape read error while skipping over inode inumber\fR\fR
703 \fB\fBTape read error while trying to resynchronize\fR\fR
707 \fB\fBA tape read error has\ occurred\fR\fR
709 .sp .6
710 .RS 4n
711 If a file name is specified, then its contents are probably partially wrong. If
712 an inode is being skipped or the tape is trying to resynchronize, then no
713 extracted files have been corrupted, though files may not be found on the tape.
717 .ne 2
719 \fB\fBresync ufsrestore, skipped\fR \fInum\fR\fR
721 .sp .6
722 .RS 4n
723 After a tape read error, \fBufsrestore\fR may have to resynchronize itself.
724 This message lists the number of blocks that were skipped over.
728 .ne 2
730 \fB\fBIncorrect tape label. Expected `foo', got `bar'.\fR\fR
732 .sp .6
733 .RS 4n
734 The \fBL\fR option was specified, and its value did not match what was recorded
735 in the header of the dump file.
738 .SH NOTES
741 \fBufsrestore\fR can get confused when doing incremental restores from dump
742 tapes that were made on active file systems.
745 A  \fBlevel 0\fR dump must be done after a full restore. Because
746 \fBufsrestore\fR runs in user mode, it has no control over inode allocation.
747 This means that \fBufsrestore\fR repositions the files, although it does not
748 change their contents. Thus, a full dump must be done to get a new set of
749 directories reflecting the new file positions, so that later incremental dumps
750 will be correct.