# xfsrestore -h xfsrestore: version X.X xfsrestore: usage: xfsrestore [ -a <alt. workspace dir> ... ] [ -e (don't overwrite existing files) ] [ -f <source> ... ] [ -h (help) ] [ -i (interactive) ] [ -n <file> (restore only if newer than) ] [ -o (restore owner/group even if not root) ] [ -p <seconds between progress reports> ] [ -r (cumulative restore) ] [ -s <subtree> ... ] [ -t (contents only) ] [ -v <verbosity {silent, verbose, trace}> ] [ -A (don't restore extended file attributes) ] [ -C (check tape record checksums) ] [ -D (restore DMAPI event settings) ] [ -E (don't overwrite if changed) ] [ -F (don't prompt) ] [ -I (display dump inventory) ] [ -J (inhibit inventory update) ] [ -L <session label> ] [ -N (timestamp messages) ] [ -O <options file> ] [ -P (pin down I/O buffers) ] [ -Q (force interrupted session completion) ] [ -R (resume) ] [ -S <session id> ] [ -T (don't timeout dialogs) ] [ -U (unload media when change needed) ] [ -V (show subsystem in messages) ] [ -W (show verbosity in messages) ] [ -X <excluded subtree> ... ] [ -Y <I/O buffer ring length> ] [ -Z (miniroot restrictions) ] [ - (stdin) ] [ <destination> ]Use xfsrestore to restore data backed up with xfsdump. You can restore files, subdirectories, and filesystems--regardless of the way they were backed up. For example, if you back up an entire filesystem in a single dump, you can select individual files and subdirectories from within that filesystem to restore.
You can use xfsrestore interactively or noninteractively. With interactive mode, you can peruse the filesystem or files backed up, selecting those you want to restore. In noninteractive operation, a single command line can restore selected files and subdirectories, or an entire filesystem. You can restore data to its original filesystem location or any other location in an EFS or XFS filesystem.
By using successive invocations of xfsrestore, you can restore incremental dumps on a base dump. This restores data in the same sequence it was dumped.
# xfsrestore -f /dev/tape /disk2 xfsrestore: version 2.0 - type ^C for status and control xfsrestore: searching media for dump xfsrestore: preparing drive xfsrestore: examining media file 0 =========================== dump selection dialog ============================ the following dump has been found on drive 0 hostname: cumulus mount point: /disk2 volume: /dev/rdsk/dks0d2s0 session time: Wed Oct 25 16:59:00 1995 level: 0 session label: "tape1" media label: "media1" file system id: d2a602fc-b21d-1001-8938-08006906dc5c session id: d2a61284-b21d-1001-8938-08006906dc5c media id: d2a61285-b21d-1001-8938-08006906dc5c restore this dump? 1: skip 2: restore (default) -> 2 this dump selected for restoral --------------------------------- end dialog --------------------------------- xfsrestore: using online session inventory xfsrestore: searching media for directory dump xfsrestore: reading directories xfsrestore: directory post-processing xfsrestore: restoring non-directory files xfsrestore: I/O metrics: 3 by 2MB ring; 9/13 (69%) records streamed; 204600B/s xfsrestore: restore complete: 104 seconds elapsedIn this case, xfsrestore went to the first dump on the tape and asked if this was the dump to restore. If you had entered 1 for "skip," xfsrestore would have proceeded to the next dump on the tape (if there was one) and asked if this was the dump you wanted to restore.
You can request a specific dump if you used xfsdump with a session label. For example:
# xfsrestore -f /dev/tape -L Wed_11_23 /usr xfsrestore: version X.X - type ^C for status and control xfsrestore: preparing tape drive xfsrestore: dump session found xfsrestore: advancing tape to next media file xfsrestore: dump session found xfsrestore: restore of level 0 dump of magnolia.abc.xyz.com:/usr created Wed Nov 23 11:17:54 1994 xfsrestore: beginning media file xfsrestore: reading ino map xfsrestore: initializing the map tree xfsrestore: reading the directory hierarchy xfsrestore: restoring non-directory files xfsrestore: ending media file xfsrestore: restoring directory attributes xfsrestore: restore complete: 200 seconds elapsedIn this way you recover a dump with a single command line and do not have to answer y or n to the prompt(s) asking you if the dump session found is the correct one. To be even more exact, use the -S option and specify the unique session ID of the particular dump session:
# xfsrestore -f /dev/tape -S \ d23cbf47-b21d-1001-8f97-080069068eeb /usr2/tmp xfsrestore: version X.X - type ^C for status and control xfsrestore: preparing tape drive xfsrestore: dump session found xfsrestore: advancing tape to next media file xfsrestore: advancing tape to next media file xfsrestore: dump session found xfsrestore: restore of level 0 dump of magnolia.abc.xyz.com:/test resumed Mon Nov 28 11:50:41 1994 xfsrestore: beginning media file xfsrestore: media file 0 (media 0, file 2) xfsrestore: reading ino map xfsrestore: initializing the map tree xfsrestore: reading the directory hierarchy xfsrestore: restoring non-directory files xfsrestore: ending media file xfsrestore: restoring directory attributes xfsrestore: restore complete: 229 seconds elapsedYou can find the session ID by viewing the dump inventory (see "Examining xfsdump Archives"). Session labels might be duplicated, but session IDs never are.
# xfsrestore -f /dev/tape -L week_1 -s people/fred/notes \ /usr/tmpYou can also restore a file "in place" that is, restore it directly to where it came from in the original backup. Note, however, that if you do not use a -e, -E, or -n option, you overwrite any existing file(s) of the same name.
In the following example, the subdirectory people/fred is restored in the destination /usr-- this overwrites any files and subdirectories in /usr/people/fred with the data on the dump tape:
# xfsrestore -f /dev/tape -L week_1 -s people/fred /usr
# xfsrestore -f magnolia:/dev/tape -L 120694u2 /usr2 xfsrestore: version X.X - type ^C for status and control xfsrestore: preparing tape drive xfsrestore: dump session found xfsrestore: advancing tape to next media file xfsrestore: dump session found xfsrestore: restore of level 0 dump of magnolia.abc.xyz.com:/usr2 created Tue Dec 6 10:55:17 1994 xfsrestore: beginning media file xfsrestore: media file 0 (media 0, file 1) xfsrestore: reading ino map xfsrestore: initializing the map tree xfsrestore: reading the directory hierarchy xfsrestore: restoring non-directory files xfsrestore: ending media file xfsrestore: restoring directory attributes xfsrestore: restore complete: 203 seconds elapsedIn this case, the dump data is extracted from the tape on magnolia, and the destination is the directory /usr2 on the local system. Refer to the section "Using xfsdump and xfsrestore to Copy Filesystems" for an example of using the standard input option of xfsrestore.
The following screen output shows an example of a simple interactive restoration.
# xfsrestore -f /dev/tape -i -v silent . xfsrestore: dump session found xfsrestore: no session label xfsrestore: session id: d23cbeda-b21d-1001-8f97-080069068eeb xfsrestore: no media label xfsrestore: media id: d23cbedb-b21d-1001-8f97-080069068eeb do you want to select this dump? (y/n): y selected --- interactive subtree selection dialog --- the following commands are available: pwd ls [ { <name>, ".." } ] cd [ { <name>, ".." } ] add [ <name> ] delete [ <name> ] extract quit help -> ls 4122 people/ 4130 two 4126 A/ 4121 one -> add two -> cd people -> ls 4124 fred/ -> add fred -> ls * 4124 fred/ -> extract ---------------- end dialog ----------------In the interactive restore session above, the subdirectory people/fred and the file two were restored relative to the current working directory ("."). Note that an asterisk (*) in your ls output indicates your selections.
In the following example, the level 0 base dump and succeeding higher level dumps are on /dev/tape. First the level 0 dump is restored, then each higher level dump in succession:
# /usr/tmp/xfsrestore -f /dev/tape -r -v silent . =========================== dump selection dialog ============================ the following dump has been found on drive 0 hostname: cumulus mount point: /disk2 volume: /dev/rdsk/dks0d2s0 session time: Wed Oct 25 14:37:47 1995 level: 0 session label: "week_1" media label: "Jun_94" file system id: d2a602fc-b21d-1001-8938-08006906dc5c session id: d2a60b26-b21d-1001-8938-08006906dc5c media id: d2a60b27-b21d-1001-8938-08006906dc5c restore this dump? 1: skip 2: restore (default) -> <Enter> this dump selected for restoral --------------------------------- end dialog --------------------------------- #Next, enter the same command again. The program goes to the next dump and again you select the default:
# xfsrestore -f /dev/tape -r -v silent . =========================== dump selection dialog ============================ the following dump has been found on drive 0 hostname: cumulus mount point: /disk2 volume: /dev/rdsk/dks0d2s0 session time: Wed Oct 25 14:40:54 1995 level: 1 session label: "week_2" media label: "Jun_94" file system id: d2a602fc-b21d-1001-8938-08006906dc5c session id: d2a60b2b-b21d-1001-8938-08006906dc5c media id: d2a60b27-b21d-1001-8938-08006906dc5c restore this dump? 1: skip 2: restore (default) -> <Enter> this dump selected for restoral --------------------------------- end dialog --------------------------------- #You then repeat this process until you have recovered the entire sequence of incremental dumps. The full and latest copy of the filesystem will then have been restored. In this case, it is restored relative to ".", that is, in the directory you are in when the sequence of xfsrestore commands is issued.
Restore an interrupted dump just as if it were an incremental dump. Use the -r option to inform xfsrestore that you are performing an incremental restore, and answer y and n appropriately to select the proper "increments" to restore (see "Cumulative Restores With xfsrestore").
Note that if you try to restore an interrupted dump as if it were a non-interrupted, non-incremental dump, the portion of the dump that occurred before the interruption is restored, but not the remainder of the dump. You can determine if a dump is an interrupted dump by looking in the online inventory.
Here is an example of a dump inventory showing an interrupted dump session (the crucial fields are in bold type):
# xfsdump -I depth=3,mobjlabel=AugTape,mnt=indy4.xyz.com:/usr file system 0: fs id: d23cb450-b21d-1001-8f97-080069068eeb session 0: mount point: indy4.xyz.com.com:/usr device: indy4.xyz.com.com:/dev/rdsk/dks0d3s2 time: Tue Dec 6 15:01:26 1994 session label: "180894usr" session id: d23cc0c3-b21d-1001-8f97-080069068eeb level: 0 resumed: NO subtree: NO streams: 1 stream 0: pathname: /dev/tape start: ino 4121 offset 0 end: ino 0 offset 0 interrupted: YES media files: 2 session 1: mount point: indy4.xyz.com.com:/usr device: indy4.xyz.com.com:/dev/rdsk/dks0d3s2 time: Tue Dec 6 15:48:37 1994 session label: "Resumed180894usr" session id: d23cc0cc-b21d-1001-8f97-080069068eeb level: 0 resumed: YES subtree: NO streams: 1 stream 0: pathname: /dev/tape start: ino 4121 offset 0 end: ino 0 offset 0 interrupted: NO media files: 2 . . .From this it can be determined that session 0 was interrupted and then resumed and completed in session 1.
To restore the interrupted dump session in the example above, use the following sequence of commands:
# xfsrestore -f /dev/tape -r -L 180894usr . # xfsrestore -f /dev/tape -r -L Resumed180894usr .This restores the entire /usr backup relative to the current directory. (You should remove the housekeeping directory from the destination directory when you are finished.)
# xfsrestore -f /dev/tape -v silent /disk2 =========================== dump selection dialog ============================ the following dump has been found on drive 0 hostname: cumulus mount point: /disk2 volume: /dev/rdsk/dks0d2s0 session time: Wed Oct 25 17:20:16 1995 level: 0 session label: "week1" media label: "newtape" file system id: d2a602fc-b21d-1001-8938-08006906dc5c session id: d2a6129e-b21d-1001-8938-08006906dc5c media id: d2a6129f-b21d-1001-8938-08006906dc5c restore this dump? 1: skip 2: restore (default) -> 2 this dump selected for restoral --------------------------------- end dialog --------------------------------- ========================= status and control dialog ========================== status at 17:23:52: 131/910 files restored, 14.4% complete, 42 seconds elapsed please select one of the following operations 1: interrupt this session 2: change verbosity 3: display metrics 4: other controls 5: continue (default) (timeout in 60 sec) -> 1 please confirm 1: interrupt this session 2: continue (default) (timeout in 60 sec) -> 1 interrupt request accepted --------------------------------- end dialog --------------------------------- xfsrestore: initiating session interruptResume the xfsrestore session with the -R option:
# xfsrestore -f /dev/tape -R -v silent /disk2Data recovery continues from the point of the interruption.
The housekeeping directory is a temporary directory used during cumulative recovery to pass information from one invocation of xfsrestore to the next. It must not be removed during the process of performing the cumulative recovery but should be removed after the cumulative recovery is completed.
The orphanage directory is created if a file or subdirectory is restored that is not referenced in the filesystem structure of the dump. For example, if you dump a very active filesystem, it is possible for new files to be in the non-directory portion of the dump, yet none of the directories dumped reference that file. A warning message is displayed, and the file is placed in the orphanage directory, named with its original inode number and generation count (for example, 123479.14.).