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"
9 ufsrestore \- incremental file system restore
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]...
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
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.
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.
43 .SS "Function Letters"
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
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.
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,
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.
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.
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
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
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"
138 \fBa \fIarchive_file\fR\fR
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.
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.
169 Convert the contents of the media in 4.1BSD format to the new \fBufs\fR file
179 Debug. Turn on debugging output.
185 \fBf \fIdump_file\fR\fR
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:
196 example# ufsdump 0f \(mi /dev/rdsk/c0t0d0s7 \e
197 | (cd /home;ufsrestore xf \(mi)
208 Extract or list the actual directory, rather than the files that it references.
209 This prevents hierarchical restoration of complete subtrees from the tape.
218 Autoload. When the end-of-tape is reached before the restore is complete, take
219 the drive off-line and wait up to two minutes (the default, see the \fBT\fR
220 function modifier) for the tape drive to be ready again. This gives autoloading
221 (stackloader) tape drives a chance to load a new tape. If the drive is ready
222 within two minutes, continue. If it is not, prompt for another tape and wait.
231 The label that should appear in the header of the dump file. If the labels do
232 not match, \fBufsrestore\fR issues a diagnostic and exits. The tape label is
233 specific to the \fBufsdump\fR tape format, and bears no resemblance to
234 \fBIBM\fR or \fBANSI\fR-standard tape labels.
243 Extract by inode numbers rather than by filename to avoid regenerating complete
244 pathnames. Regardless of where the files are located in the dump hierarchy,
245 they are restored into the current directory and renamed with their inode
246 number. This is useful if only a few files are being extracted.
255 Offline. Take the drive off-line when the restore is complete or the
256 end-of-media is reached and rewind the tape, or eject the diskette. In the case
257 of some autoloading 8mm drives, the tape is removed from the drive
267 Skip to the \fIn\fRth file when there are multiple dump files on the same tape.
268 For example, the command:
272 example# ufsrestore xfs /dev/rmt/0hn 5
277 would position you to the fifth file on the tape when reading volume 1 of the
278 dump. If a dump extends over more than one volume, all volumes except the first
279 are assumed to start at position 0, no matter what "\fBs\fR \fIn\fR" value is
282 If "\fBs\fR \fIn\fR" is specified, the backup media must be at \fBBOT\fR
283 (beginning of tape). Otherwise, the initial positioning to read the table of
284 contents will fail, as it is performed by skipping the tape forward
285 \fIn\fR\fB-1\fR files rather than by using absolute positioning. This is
286 because on some devices absolute positioning is very time consuming.
292 \fBT timeout [hms]\fR
295 Sets the amount of time to wait for an autoload command to complete. This
296 function modifier is ignored unless the \fBl\fR function modifier has also been
297 specified. The default timeout period is two minutes. The time units may be
298 specified as a trailing \fBh\fR (hours), \fBm\fR (minutes), or \fBs\fR
299 (seconds). The default unit is minutes.
308 Verbose. \fBufsrestore\fR displays the name and inode number of each file it
309 restores, preceded by its file type.
318 Do not ask whether to abort the restore in the event of tape errors.
319 \fBufsrestore\fR tries to skip over the bad tape block(s) and continue as best
323 .SS "Interactive Commands"
326 \fBufsrestore\fR enters interactive mode when invoked with the \fBi\fR function
327 letters. Interactive commands are reminiscent of the shell. For those commands
328 that accept an argument, the default is the current directory. The interactive
333 \fBadd [\fIfilename\fR]\fR
336 Add the named file or directory to the list of files to extract. If a directory
337 is specified, add that directory and its files (recursively) to the extraction
338 list (unless the \fBh\fR modifier is in effect).
344 \fBcd \fIdirectory\fR\fR
347 Change to \fIdirectory\fR (within the dump file).
353 \fBdelete [\fIfilename\fR]\fR
356 Delete the current directory, or the named file or directory from the list of
357 files to extract. If a directory is specified, delete that directory and all
358 its descendents from the extraction list (unless the \fBh\fR modifier is in
359 effect). The most expedient way to extract a majority of files from a directory
360 is to add that directory to the extraction list, and then delete specific files
370 Extract all files on the extraction list from the dump media. \fBufsrestore\fR
371 asks which volume the user wishes to mount. The fastest way to extract a small
372 number of files is to start with the last volume and work toward the first. If
373 "\fBs\fR \fIn\fR" is given on the command line, volume 1 will automatically be
374 positioned to file \fIn\fR when it is read.
383 Display a summary of the available commands.
389 \fBls [\fIdirectory\fR]\fR
392 List files in \fIdirectory\fR or the current directory, represented by a
393 `\fB\&.\fR' (period). Directories are appended with a `\fB/\fR' (slash).
394 Entries marked for extraction are prefixed with a `\fB*\fR' (asterisk). If the
395 verbose option is in effect, inode numbers are also listed.
401 \fBmarked [\fIdirectory\fR]\fR
404 Like \fBls\fR, except only files marked for extraction are listed.
413 Toggle the pagination of the output from the \fBls\fR and \fBmarked\fR
414 commands. The pager used is that defined by the \fBPAGER\fR environment
415 variable, or more(1) if that envar is not defined. The \fBPAGER\fR envar may
416 include white-space-separated arguments for the pagination program.
425 Print the full pathname of the current working directory.
434 \fBufsrestore\fR exits immediately, even if the extraction list is not empty.
443 Prompts: \fBset owner/mode for\fR `\fB\&.\fR' (period). Type \fBy\fR for yes to
444 set the mode (permissions, owner, times) of the current directory `\fB\&.\fR'
445 (period) into which files are being restored equal to the mode of the root
446 directory of the file system from which they were dumped. Normally, this is
447 what you want when restoring a whole file system, or restoring individual files
448 into the same locations from which they were dumped. Type \fBn\fR for no, to
449 leave the mode of the current directory unchanged. Normally, this is what you
450 want when restoring part of a dump to a directory other than the one from which
451 the files were dumped.
457 \fBsetpager \fIcommand\fR\fR
460 Sets the command to use for paginating output instead of the default or that
461 inherited from the environment. The \fIcommand\fR string may include arguments
462 in addition to the command itself.
471 Toggle the status of the \fBv\fR modifier. While \fBv\fR is in effect, the
472 \fBls\fR command lists the inode numbers of all entries, and \fBufsrestore\fR
473 displays information about each file as it is extracted.
482 Display the dump header on the media.
488 The following operands are supported.
495 Specifies the pathname of files (or directories) to be restored to disk. Unless
496 the \fBh\fR function modifier is also used, a directory name refers to the
497 files it contains, and (recursively) its subdirectories and the files they
498 contain. \fIfilename\fR is associated with either the \fBx\fR or \fBt\fR
499 function letters, and must come last.
505 See \fBlargefile\fR(5) for the description of the behavior of \fBufsrestore\fR
506 when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
510 The following exit values are returned:
517 Successful completion.
526 An error occurred. Verbose messages are displayed.
529 .SH ENVIRONMENT VARIABLES
536 The command to use as a filter for paginating output. This can also be used to
537 specify the options to be used. Default is \fBmore\fR(1).
546 Selects the directory for temporary files. Defaults to \fB/tmp\fR if not
547 defined in the environment.
554 \fB\fB/dev/rmt/0\fR\fR
557 the default tape drive
563 \fB\fB$TMPDIR/rstdir*\fR\fR
566 file containing directories on the tape
572 \fB\fB$TMPDIR/rstmode*\fR\fR
575 owner, mode, and timestamps for directories
581 \fB\fB\&./restoresymtable\fR\fR
584 information passed between incremental restores
590 \fBmore\fR(1), \fBmkfs\fR(1M), \fBmount\fR(1M), \fBrmt\fR(1M),
591 \fBufsdump\fR(1M), \fBufsdump\fR(4), \fBattributes\fR(5), \fBlargefile\fR(5)
595 \fBufsrestore\fR complains about bad option characters.
598 Read errors result in complaints. If \fBy\fR has been specified, or the user
599 responds \fBy\fR, \fBufsrestore\fR will attempt to continue.
602 If the dump extends over more than one tape, \fBufsrestore\fR asks the user to
603 change tapes. If the \fBx\fR or \fBi\fR function letter has been specified,
604 \fBufsrestore\fR also asks which volume the user wishes to mount. If the
605 \fBs\fR modifier has been specified, and volume 1 is mounted, it is
606 automatically positioned to the indicated file.
609 There are numerous consistency checks that can be listed by \fBufsrestore\fR.
610 Most checks are self-explanatory or can "never happen". Common errors are given
615 \fB\fBConverting to new file system format\fR\fR
619 A dump tape created from the old file system has been loaded. It is
620 automatically converted to the new file system format.
626 \fB\fIfilename\fR\fB: not found on tape\fR\fR
630 The specified file name was listed in the tape directory, but was not found on
631 the tape. This is caused by tape read errors while looking for the file, using
632 a dump tape created on an active file system, or restoring a partial dump with
633 the \fBr\fR function.
639 \fB\fBexpected next file\fR \fIinumber\fR\fB, got\fR \fIinumber\fR\fR
643 A file that was not listed in the directory showed up. This can occur when
644 using a dump tape created on an active file system.
650 \fB\fBIncremental tape too low\fR\fR
654 When doing an incremental restore, a tape that was written before the previous
655 incremental tape, or that has too low an incremental level has been loaded.
661 \fB\fBIncremental tape too high\fR\fR
665 When doing incremental restore, a tape that does not begin its coverage where
666 the previous incremental tape left off, or one that has too high an incremental
667 level has been loaded.
673 \fB\fBmedia\fR \fBread\fR \fBerror:\fR \fBinvalid\fR \fBargument\fR\fR
677 Blocking factor specified for read is smaller than the blocking factor used to
684 \fB\fBTape read error while restoring\fR\fR
688 \fB\fBTape read error while skipping over inode inumber\fR\fR
692 \fB\fBTape read error while trying to resynchronize\fR\fR
696 \fB\fBA tape read error has\ occurred\fR\fR
700 If a file name is specified, then its contents are probably partially wrong. If
701 an inode is being skipped or the tape is trying to resynchronize, then no
702 extracted files have been corrupted, though files may not be found on the tape.
708 \fB\fBresync ufsrestore, skipped\fR \fInum\fR\fR
712 After a tape read error, \fBufsrestore\fR may have to resynchronize itself.
713 This message lists the number of blocks that were skipped over.
719 \fB\fBIncorrect tape label. Expected `foo', got `bar'.\fR\fR
723 The \fBL\fR option was specified, and its value did not match what was recorded
724 in the header of the dump file.
730 \fBufsrestore\fR can get confused when doing incremental restores from dump
731 tapes that were made on active file systems.
734 A \fBlevel 0\fR dump must be done after a full restore. Because
735 \fBufsrestore\fR runs in user mode, it has no control over inode allocation.
736 This means that \fBufsrestore\fR repositions the files, although it does not
737 change their contents. Thus, a full dump must be done to get a new set of
738 directories reflecting the new file positions, so that later incremental dumps