Move everything from /var/adm to /var/log
[unleashed.git] / share / man / man8 / ufsrestore.8
blob82ff9af576e2c66821e2b7de65e4e5f758dd9cb2
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 8 "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(8)), 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(8) 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
203 .ne 2
205 \fBh\fR
207 .RS 19n
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.
213 .ne 2
215 \fBl\fR
217 .RS 19n
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.
226 .ne 2
228 \fBL \fIlabel\fR\fR
230 .RS 19n
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.
238 .ne 2
240 \fBm\fR
242 .RS 19n
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.
250 .ne 2
252 \fBo\fR
254 .RS 19n
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
258 automatically.
262 .ne 2
264 \fBs \fIn\fR\fR
266 .RS 19n
267 Skip to the \fIn\fRth file when there are multiple dump files on the same tape.
268 For example, the command:
270 .in +2
272 example# ufsrestore xfs /dev/rmt/0hn 5
274 .in -2
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
280 specified.
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.
290 .ne 2
292 \fBT timeout [hms]\fR
294 .RS 19n
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.
303 .ne 2
305 \fBv\fR
307 .RS 19n
308 Verbose. \fBufsrestore\fR displays the name and inode number of each file it
309 restores, preceded by its file type.
313 .ne 2
315 \fBy\fR
317 .RS 19n
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
320 it can.
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
329 options are:
331 .ne 2
333 \fBadd [\fIfilename\fR]\fR
335 .RS 22n
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).
342 .ne 2
344 \fBcd \fIdirectory\fR\fR
346 .RS 22n
347 Change to \fIdirectory\fR (within the dump file).
351 .ne 2
353 \fBdelete [\fIfilename\fR]\fR
355 .RS 22n
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
361 to omit.
365 .ne 2
367 \fBextract\fR
369 .RS 22n
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.
378 .ne 2
380 \fBhelp\fR
382 .RS 22n
383 Display a summary of the available commands.
387 .ne 2
389 \fBls [\fIdirectory\fR]\fR
391 .RS 22n
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.
399 .ne 2
401 \fBmarked [\fIdirectory\fR]\fR
403 .RS 22n
404 Like \fBls\fR, except only files marked for extraction are listed.
408 .ne 2
410 \fBpager\fR
412 .RS 22n
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.
420 .ne 2
422 \fBpwd\fR
424 .RS 22n
425 Print the full pathname of the current working directory.
429 .ne 2
431 \fBquit\fR
433 .RS 22n
434 \fBufsrestore\fR exits immediately, even if the extraction list is not empty.
438 .ne 2
440 \fBsetmodes\fR
442 .RS 22n
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.
455 .ne 2
457 \fBsetpager \fIcommand\fR\fR
459 .RS 22n
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.
466 .ne 2
468 \fBverbose\fR
470 .RS 22n
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.
477 .ne 2
479 \fBwhat\fR
481 .RS 22n
482 Display the dump header on the media.
485 .SH OPERANDS
488 The following operands are supported.
490 .ne 2
492 \fB\fIfilename\fR\fR
494 .RS 12n
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.
502 .SH EXIT STATUS
505 The following exit values are returned:
507 .ne 2
509 \fB\fB0\fR\fR
511 .RS 5n
512 Successful completion.
516 .ne 2
518 \fB\fB1\fR\fR
520 .RS 5n
521 An error occurred. Verbose messages are displayed.
524 .SH ENVIRONMENT VARIABLES
526 .ne 2
528 \fBPAGER\fR
530 .RS 10n
531 The command to use as a filter for paginating output. This can also be used to
532 specify the options to be used. Default is \fBmore\fR(1).
536 .ne 2
538 \fBTMPDIR\fR
540 .RS 10n
541 Selects the directory for temporary files. Defaults to \fB/tmp\fR if not
542 defined in the environment.
545 .SH FILES
547 .ne 2
549 \fB\fB/dev/rmt/0\fR\fR
551 .RS 23n
552 the default tape drive
556 .ne 2
558 \fB\fB$TMPDIR/rstdir*\fR\fR
560 .RS 23n
561 file containing directories on the tape
565 .ne 2
567 \fB\fB$TMPDIR/rstmode*\fR\fR
569 .RS 23n
570 owner, mode, and timestamps for directories
574 .ne 2
576 \fB\fB\&./restoresymtable\fR\fR
578 .RS 23n
579 information passed between incremental restores
582 .SH SEE ALSO
585 \fBmore\fR(1), \fBmkfs\fR(8), \fBmount\fR(8), \fBrmt\fR(8),
586 \fBufsdump\fR(8), \fBufsdump\fR(4), \fBattributes\fR(5)
587 .SH DIAGNOSTICS
590 \fBufsrestore\fR complains about bad option characters.
593 Read errors result in complaints. If \fBy\fR has been specified, or the user
594 responds \fBy\fR, \fBufsrestore\fR will attempt to continue.
597 If the dump extends over more than one tape, \fBufsrestore\fR asks the user to
598 change tapes. If the \fBx\fR or \fBi\fR function letter has been specified,
599 \fBufsrestore\fR also asks which volume the user wishes to mount. If the
600 \fBs\fR modifier has been specified, and volume 1 is mounted, it is
601 automatically positioned to the indicated file.
604 There are numerous consistency checks that can be listed by \fBufsrestore\fR.
605 Most checks are self-explanatory or can "never happen". Common errors are given
606 below.
608 .ne 2
610 \fB\fBConverting to new file system format\fR\fR
612 .sp .6
613 .RS 4n
614 A dump tape created from the old file system has been loaded. It is
615 automatically converted to the new file system format.
619 .ne 2
621 \fB\fIfilename\fR\fB: not found on tape\fR\fR
623 .sp .6
624 .RS 4n
625 The specified file name was listed in the tape directory, but was not found on
626 the tape. This is caused by tape read errors while looking for the file, using
627 a dump tape created on an active file system, or restoring a partial dump with
628 the \fBr\fR function.
632 .ne 2
634 \fB\fBexpected next file\fR \fIinumber\fR\fB, got\fR \fIinumber\fR\fR
636 .sp .6
637 .RS 4n
638 A file that was not listed in the directory showed up. This can occur when
639 using a dump tape created on an active file system.
643 .ne 2
645 \fB\fBIncremental tape too low\fR\fR
647 .sp .6
648 .RS 4n
649 When doing an incremental restore, a tape that was written before the previous
650 incremental tape, or that has too low an incremental level has been loaded.
654 .ne 2
656 \fB\fBIncremental tape too high\fR\fR
658 .sp .6
659 .RS 4n
660 When doing incremental restore, a tape that does not begin its coverage where
661 the previous incremental tape left off, or one that has too high an incremental
662 level has been loaded.
666 .ne 2
668 \fB\fBmedia\fR \fBread\fR \fBerror:\fR \fBinvalid\fR \fBargument\fR\fR
670 .sp .6
671 .RS 4n
672 Blocking factor specified for read is smaller than the blocking factor used to
673 write data.
677 .ne 2
679 \fB\fBTape read error while restoring\fR\fR
683 \fB\fBTape read error while skipping over inode inumber\fR\fR
687 \fB\fBTape read error while trying to resynchronize\fR\fR
691 \fB\fBA tape read error has\ occurred\fR\fR
693 .sp .6
694 .RS 4n
695 If a file name is specified, then its contents are probably partially wrong. If
696 an inode is being skipped or the tape is trying to resynchronize, then no
697 extracted files have been corrupted, though files may not be found on the tape.
701 .ne 2
703 \fB\fBresync ufsrestore, skipped\fR \fInum\fR\fR
705 .sp .6
706 .RS 4n
707 After a tape read error, \fBufsrestore\fR may have to resynchronize itself.
708 This message lists the number of blocks that were skipped over.
712 .ne 2
714 \fB\fBIncorrect tape label. Expected `foo', got `bar'.\fR\fR
716 .sp .6
717 .RS 4n
718 The \fBL\fR option was specified, and its value did not match what was recorded
719 in the header of the dump file.
722 .SH NOTES
725 \fBufsrestore\fR can get confused when doing incremental restores from dump
726 tapes that were made on active file systems.
729 A  \fBlevel 0\fR dump must be done after a full restore. Because
730 \fBufsrestore\fR runs in user mode, it has no control over inode allocation.
731 This means that \fBufsrestore\fR repositions the files, although it does not
732 change their contents. Thus, a full dump must be done to get a new set of
733 directories reflecting the new file positions, so that later incremental dumps
734 will be correct.