Chapter 3. Dumping and Restoring XFS Filesystems

This chapter describes how the xfsdump and xfsrestore utilities work and how to use them to back up and recover data on XFS filesystems. (The xfsdump(1M) and xfsrestore(1M) reference pages provide online information on these utilities.) A short section at the end of this chapter, “Other Backup Utilities,” discusses XFS-related issues of other utilities that can be used to perform backups.

This chapter contains the following sections:

Table 3-1 and Table 3-2 summarize when to use xfsdump and xfsrestore and when their EFS counterparts, dump(1M) and restore(1M), must be used

Table 3-1. Filesystems and Dump Utilities

For a Filesystem of Type

Dump It Using

EFS

dump

XFS

xfsdump


Table 3-2. Filesystems and Restore Utilities

For a Dump Made Using

Restore It Using

On a Filesystem of Type

dump

restore

EFS or XFS

xfsdump

xfsrestore

EFS or XFS

Note than you can restore data in either EFS or XFS filesystems, but must use the restore utility that corresponds with the dump utility used to make the backup. The xfsdump and xfsrestore utilities are only available with the XFS filesystem.

About the xfsdump and xfsrestore Utilities

This section provides an overview of the features of the xfsdump and xfsrestore utilities and describes the data format on storage media that supports this functionality.

Features of xfsdump and xfsrestore

This section summarizes the features of xfsdump and xfsrestore. Flexibility of operation, integration with system software, ease of use, and record keeping abilities are discussed.

Flexibility

  • With xfsdump and xfsrestore, you can back up and restore data using local or remote drives. Multiple dumps can be placed on a single media object.

  • xfsdump and xfsrestore support incremental dumps. Also, you can back up filesystems, directories, and/or individual files, and then restore filesystems, directories, and files independent of how they were backed up.

  • With xfsdump and xfsrestore, you can recover from intentional or accidental interruptions.

  • With xfsrestore, you can restore xfsdump data onto EFS filesystems. (xfsdump backs up mounted XFS filesystems only.)

Integration

  • xfsdump and xfsrestore support XFS features including 64-bit inode numbers, file lengths, holes, and user-selectable extent sizes.

  • xfsdump and xfsrestore support multiple media types, all IRIX-supported file types (regular, directory, symbolic link, block and character special, FIFO, and socket), and retain hard links.

  • xfsdump does not affect the state of the filesystem being dumped (for example, access times are retained), and xfsrestore restores files as close to the original as possible.

  • xfsrestore detects and bypasses media errors and recovers rapidly after encountering them.

  • xfsdump does not cross mount points, local or remote.

User Interface

  • xfsdump optionally prompts for additional media when the end of the current media is reached. Operator estimates of media capacity are not required. xfsdump also supports automated backups.

  • xfsdump maintains an extensive online inventory of all dumps performed. Inventory contents can be viewed through various filters to quickly locate specific dump information.

  • xfsrestore supports interactive operation, allowing selection of individual files or directories for recovery. It also permits selection from among backups performed at different times when multiple dumps are available.

  • Dump contents may also be viewed noninteractively.

Media Layout

The following section introduces some terminology and then describes the way xfsdump formats data on the storage media for use by xfsrestore.

Terminology

This section introduces terminology used in the rest of this chapter.

While xfsdump and xfsrestore are often used with tape media, the utilities actually support multiple kinds of media, so in the following discussions, the term media object is used to refer to the media in a generic fashion. The term dump refers to the result of a single use of the xfsdump command to output data files to the selected media object(s). An instance of the use of xfsdump is referred to as a dump session.

The dump session sends a single dump stream to the media object(s). The dump stream may contain as little as a single file or as much as an entire filesystem. The dump stream is composed of dump objects, which are:

  • one or more data segments

  • an optional dump inventory

  • a stream terminator

The data segment(s) contains the actual data, the dump inventory contains a list of the dump objects in the dump, and the stream terminator marks the end of the dump stream. When a dump stream is composed of multiple dump objects, each object is contained in a media file. Some output devices, for example standard output, do not support the concept of media files—the dump stream is only the data.

Possible Dump Layouts

The simplest dump, for example the dump of a small amount of data to a single tape, produces a data segment and a stream terminator as the only dump objects. If the optional inventory object is added, you have a dump such as that illustrated in Figure 3-1. (In the data layout diagrams in this section, the optional inventory object is always included.)

Figure 3-1. Single Dump on Single Media Object


You can also dump data streams that are larger than a single media object. The data stream can be broken between any two media files including data segment boundaries. (The inventory is never broken into segments.) The xfsdump utility prompts for a new media object when the end of the current media object is reached. Figure 3-2 illustrates the data layout of a single dump session that requires two media objects.

Figure 3-2. Single Dump on Multiple Media Objects


The xfsdump utility also accommodates multiple dumps on a single media object. When dumping to tape, for example, the tape is automatically advanced past the existing dump session(s) and the existing stream terminator is erased. The new dump data is then written, followed by the new stream terminator[1] . Figure 3-3 illustrates the layout of media files for two dumps on a single media object.

Figure 3-3. Multiple Dumps on Single Media Object


Figure 3-4 illustrates a case in which multiple dumps use multiple media objects. If media files already exist on the additional media object(s), the xfsdump utility finds the existing stream terminator, erases it, and begins writing the new dump data stream.

Figure 3-4. Multiple Dumps on Multiple Media Objects


Using xfsdump

This section discusses how to use the xfsdump command to backup data to local and remote devices. You can get a summary of xfsdump syntax with the –h option:

# xfsdump -h
xfsdump: version X.X
xfsdump: usage: xfsdump [ -f <destination> ]
                        [ -h (help) ]
                        [ -l <level> ]
                        [ -s <subtree> ... ]
                        [ -v <verbosity {silent, verbose, trace}> ]
                        [ -F (don't prompt) ]
                        [ -I (display dump inventory) ]
                        [ -J (inhibit inventory update) ]
                        [ -L <session label> ]
                        [ -M <media label> ]
                        [ -R (resume) ]
                        [ - (stdout) ]
                        <source (mntpnt|device)>

You must be the superuser to use xfsdump. Refer to the xfsdump(1M) reference page for details.

Specifying Media

You can use xfsdump to back up data to various media. For example, you can dump data to a tape or hard disk. The drive containing the media object may be connected to the local system or accessible over the network.

Backing Up to a Local Tape Drive

Following is an example of a level 0 dump to a local tape drive. Note that dump level does not need to be specified for a level 0 dump. (Refer to “Incremental and Resumed Dumps” for a discussion of dump levels.)

# xfsdump -f /dev/tape -L testers_11_21_94 -M test_1 /usr
xfsdump: version 1.0 - type ^C for status and control
xfsdump: level 0 dump of magnolia.wpd.sgi.com:/usr
xfsdump: dump date: Thu Dec 15 10:15:56 1994
xfsdump: session id: d23b2d9e-b21d-1001-887f-080069068eeb
xfsdump: session label: "testers_11_21_94"
xfsdump: preparing tape drive
xfsdump: no previous dumps on tape
xfsdump: ino map phase 1: skipping (no subtrees specified)
xfsdump: ino map phase 2: constructing initial dump list
xfsdump: ino map phase 3: skipping (no pruning necessary)
xfsdump: ino map phase 4: estimating dump size
xfsdump: ino map phase 5: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: beginning media file
xfsdump: media file 0 (media 0, file 0)
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-directory files
xfsdump: ending media file
xfsdump: media file size 16871936 bytes
xfsdump: dumping session inventory
xfsdump: beginning inventory media file
xfsdump: media file 1 (media 0, file 1)
xfsdump: ending inventory media file
xfsdump: inventory media file size 2102812 bytes
xfsdump: dump complete: 207 seconds elapsed

In this case, a session label (–L option) and a media label (–M option) are supplied, and the entire filesystem is dumped. Since no verbosity option is supplied, the default of verbose is used, resulting in the detailed screen output. The dump inventory is updated with the record of this backup because the -J option is not specified.

Following is an example of a backup of a subdirectory of a filesystem. In this example, the verbosity is set to silent, and the dump inventory is not updated (–J option):

# xfsdump -f /dev/tape -v silent -J -s people/fred /usr

Note that the subdirectory backed up (/usr/people/fred) was specified relative to the filesystem, so the specification did not include the name of the filesystem (in this case, /usr). Since /usr may be a very large filesystem and the -v silent option was used, this could take a long time during which there would be no screen output.

Backing Up to a Remote Tape Drive

To back up data to a remote tape drive, use the standard remote system syntax, specifying the system (by hostname if supported by a nameserver or IP address if not) followed by a colon (:), then the pathname of the special file.


Note: For remote backups, use the variable block size tape device if the device supports variable block size operation, otherwise use the fixed block size device (see intro(7)).

The following example shows a subtree backup with no inventory to a remote tape device:

# xfsdump -f theduke:/dev/rmt/tps0d2v -J -s people/fred /usr
xfsdump: version X.X - type ^C for status and control
xfsdump: dump date: Mon Nov 21 13:56:01 1994
xfsdump: level 0 dump
xfsdump: preparing tape drive
xfsdump: end of data found
xfsdump: ino map phase 1: parsing subtree selections
xfsdump: ino map phase 2: constructing initial dump list
xfsdump: ino map phase 3: pruning unneeded subtrees
xfsdump: ino map phase 4: estimating dump size
xfsdump: ino map phase 5: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: beginning media file
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-dir files
xfsdump: ending media file
xfsdump: media file size 15190208 bytes

In this case, /usr/people/fred is backed up to the variable block size tape device on the remote system theduke.


Note: The superuser account on the local system must be able to rsh to the remote system without a password. For more information, see hosts.equiv(4).


Backing Up to a File

You can back up data to a file instead of a device. In the following example, a file (Makefile) and a directory (Source) are backed up to a dump file (monday_backup) in /usr/tmp on the local system:

# xfsdump -f /usr/tmp/monday_backup -v silent -J -s \
people/fred/Makefile -s people/fred/Source /usr

You may also dump to a file on a remote system, but note that the file must be in the remote system's /dev directory. For example, the following command backs up the /usr/people/fred subdirectory on the local system to the regular file /dev/fred_mon_12-2 on the remote system theduke:

# xfsdump -f theduke:/dev/fred_mon_12-2 -s people/fred /usr

Alternatively, you could dump to any remote file if that file is on an NFS-mounted filesystem. In any case, permission settings on the remote system must allow to write to the file.

Refer to the section “Dump and Restore With STDIN/STDOUT” for information on using the standard input and standard output capabilities of xfsdump and xfsrestore to pipe data between filesystems or across the network.

Reusing Tapes

When you use a new tape as the media object of a dump session, xfsdump begins writing dump data at the beginning of the tape without prompting. If the tape already has dump data on it, xfsdump begins writing data after the last dump stream, again without prompting.

If, however, the tape contains data that is not from a dump session, xfsdump prompts you before continuing:

# xfsdump -f /dev/tape /test 
xfsdump: version X.X - type ^C for status and control
xfsdump: dump date: Fri Dec 2 11:25:19 1994
xfsdump: level 0 dump
xfsdump: session id: d23cc072-b21d-1001-8f97-080069068eeb
xfsdump: preparing tape drive
xfsdump: this tape contains data that is not part of an XFS dump
xfsdump: do you want to overwrite this tape?
type y to overwrite, n to change tapes or abort (y/n):

You must answer y if you want to continue with the dump session, or n to quit. If you answer y, the dump session resumes and the tape is overwritten. If you do not respond to the prompt, the session will eventually timeout. Note that this means that an automatic backup, for example one initiated by a crontab entry, will not succeed—unless you specified the -F option with the xfsdump command, which forces it to overwrite the tape rather than prompt for approval.

Erasing Used Tapes

Erase pre-existing data on tapes with the mt erase command. Make sure the tape is not write-protected.

For example, to prepare a used tape in the local default tape drive, enter:

# mt -f /dev/tape erase


Caution: This erases all data on the tape, including any dump sessions.

The tape can now used by xfsdump without prompting for approval.

Incremental and Resumed Dumps

Incremental dumps are a way of backing up less data at a time but still preserving current versions of all your backed-up files, directories, and so on. Incremental backups are organized numerically by levels from 0 through 9. A level 0 dump always backs up the complete filesystem. A dump level of any other number backs up all files that have changed since a dump with a lower dump level number.

For example, if you perform a level 2 backup on a filesystem one day and your next dump is a level 3 backup, only those files that have changed since the level 2 backup are dumped with the level 3 backup. In this case, the level 2 backup is called the base dump for the level 3 backup. The base dump is the most recent backup of that filesystem with a lower dump level number.

Resumed dumps work in much the same way. When a dump is resumed after it has been interrupted, the remaining files that had been scheduled to be backed up during the interrupted dump session are backed up, and any files that changed during the interruption are also backed up. Note that you must restore an interrupted dump as if it is an incremental dump (see “Cumulative Restores”).

Incremental Dump Example

In the following example, a new tape is used and the level 0 dump is the first dump written to it:

# xfsdump -f /dev/tape -l 0 -M Jun_94 -L week_1 -v silent /usr

A week later, a level 1 dump of the filesystem is performed on the same tape:

# xfsdump -f /dev/tape -l 1 -L week_2 /usr

The tape is forwarded past the existing dump data and the new data from the level 1 dump is written after it. (Note that it is not necessary to specify the media label for each successive dump on a media object.)

A week later, a level 2 dump is taken:

# xfsdump -f /dev/tape -l 2 -L week_3 /usr

and so on, for the four weeks of a month in this example, the fourth week being a level 3 dump (up to nine dump levels are supported). Refer to “Cumulative Restores” for information on the proper procedure for restoring incremental dumps.

Resumed Dump Example

You can interrupt a dump session and resume it later. To interrupt a dump session, type the interrupt character (typically CTRL-C). You receive a list of options which allow you to interrupt the session, change verbosity level, or resume the session.

In the following example, xfsdump is interrupted after dumping approximately 20% of a filesystem:

# xfsdump -f /dev/tape -L 210994u -v silent /usr
xfsdump: this tape contains data that is not part of an XFS dump
xfsdump: do you want to overwrite this tape?
type y to overwrite, n to change tapes or abort (y/n): y
overwriting
^C
status: 91/168 files dumped, 20.48 percent complete, 70 seconds elapsed
0: interrupt this session
1: change verbosity
2: continue
 -> 0
session interrupt initiated
xfsdump: dump interrupted prior to ino 11615 offset 0

You can later continue the dump by including the –R option and a different session label:

# xfsdump -f /dev/tape -R -L 2nd210994u -v silent /usr

Any files that were not backed up before the interruption, and any file changes that were made during the interruption, are backed up after the dump is resumed.


Note: Use of the –R option requires that the dump was made with a dump inventory taken, that is, the –J option was not used with xfsdump.


Viewing the Dump Inventory

The dump inventory is maintained in the directory /var/xfsdump created by xfsdump. You can view the dump inventory at any time with the xfsdump –I command. With no other arguments, xfsdump –I displays the entire dump inventory. (The xfsdump -I command does not require root privileges.)

The following output presents a section of a dump inventory.

# xfsdump -I | more
file system 0:
        fs id:          d23cb450-b21d-1001-8f97-080069068eeb
        session 0:
                mount point:    magnolia.wpd.xyz.com:/test
                device:         magnolia.wpd.xyz.com:/dev/rdsk/dks0d3s2
                time:           Mon Nov 28 11:44:04 1994
                session label:  ""
                session id:     d23cbf44-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
                        media file 0:
                                mfile index:    0
---more---

Notice that the dump inventory records are presented sequentially and are indented to illustrate the hierarchical order of the dump information.

You can view a subset of the dump inventory by specifying the level of depth (1, 2, or 3) that you want to view. For example, specifying depth=2 filters out a lot of the specific dump information as you can see by comparing the previous output with this:

# xfsdump -I depth=2
file system 0:
        fs id:          d23cb450-b21d-1001-8f97-080069068eeb
        session 0:
                mount point:    magnolia.wpd.xyz.com:/test
                device:         magnolia.wpd.xyz.com:/dev/rdsk/dks0d3s2
                time:           Mon Nov 28 11:44:04 1994
                session label:  ""
                session id:     d23cbf44-b21d-1001-8f97-080069068eeb
                level:          0
                resumed:        NO
                subtree:        NO
                streams:        1
        session 1:
                mount point:    magnolia.wpd.xyz.com:/test
                device:         magnolia.wpd.xyz.com:/dev/rdsk/dks0d3s2
               .
               .
               .

You can also view a filesystem-specific inventory by specifying the filesystem mount point with the mnt option. The following output shows an example of a dump inventory display in which the depth is set to 1, and only a single filesystem is displayed:

# xfsdump -I depth=1,mnt=magnolia.wpd.xyz.com:/test
file system 0:
        fs id:          d23cb450-b21d-1001-8f97-080069068eeb

Note that you can also look at a list of contents on the dump media itself by using the –t option with xfsrestore. (The xfsrestore utility is discussed in detail in the following section.) For example, to list the contents of the dump tape currently in the local tape drive:

# xfsrestore -f /dev/tape -t -v silent | more
xfsrestore: dump session found
xfsrestore: session label: "week_1"
xfsrestore: session id: d23cbcb4-b21d-1001-8f97-080069068eeb
xfsrestore: no media label
xfsrestore: media id: d23cbcb5-b21d-1001-8f97-080069068eeb
do you want to select this dump? (y/n): y
selected
one
A/five
people/fred/TOC
people/fred/ch3.doc
people/fred/ch3TOC.doc
people/fred/questions
A/four
people/fred/script_0
people/fred/script_1
people/fred/script_2
people/fred/script_3
people/fred/sub1/TOC
people/fred/sub1/ch3.doc
people/fred/sub1/ch3TOC.doc
people/fred/sub1/questions
people/fred/sub1/script_0
people/fred/sub1/script_1
people/fred/sub1/script_2
people/fred/sub1/script_3
people/fred/sub1/xdump1.doc
people/fred/sub1/xdump1.doc.backup
people/fred/sub1/xfsdump.doc
people/fred/sub1/xfsdump.doc.auto
people/fred/sub1/sub2/TOC
---more---

Using xfsrestore

This section discusses the xfsrestore command, which you must use to view and extract data from the dump data created by xfsdump. You can get a summary of xfsrestore syntax with the –h option:

# 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) ]
                              [ -r (cumulative restore) ]
                              [ -s <subtree> ... ]
                              [ -t (contents only) ]
                              [ -v <verbosity {silent, verbose, trace}> ]
                              [ -E (don't overwrite if changed) ]
                              [ -I (display dump inventory) ]
                              [ -L <session label> ]
                              [ -R (resume) ]
                              [ -S <session id> ]
                              [ - (stdin) ]
                              [ <destination> ]

You must be the superuser to use xfsrestore. Refer to the xfsrestore(1M) reference page for additional information.

xfsrestore Operations

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.

Simple Restores

A simple restore is a non-cumulative restore (for information on restoring incremental dumps, refer to “Cumulative Restores”). An example of a simple, noninteractive use of xfsrestore is:

# xfsrestore -f /dev/tape /usr
xfsrestore: version X.X - type ^C for status and control
xfsrestore: preparing tape drive
xfsrestore: dump session found
xfsrestore: no session label
xfsrestore: session id: d23cbbbe-b21d-1001-8f97-080069068eeb
xfsrestore: no media label
xfsrestore: media id: d23cbbbf-b21d-1001-8f97-080069068eeb
do you want to restore this dump? (y/n): y
beginning restore
xfsrestore: restore of level 0 dump of magnolia.wpd.xyz.com:/usr created Tue Nov 22 15:47: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: 115 seconds elapsed

In this case, xfsrestore went to the first dump on the tape and asked if this was the dump to restore. If you had answered n, 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.wpd.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 elapsed

In 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.wpd.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 elapsed

You can find the session ID by viewing the dump inventory (see “Viewing the Dump Inventory”). Session labels might be duplicated, but session IDs never are.

Restoring Individual Files

On the xfsrestore command line, you can specify an individual file or subdirectory to restore. In this example, the file people/fred/notes is restored and placed in the /usr/tmp directory (that is, the file is restored in /usr/tmp/people/fred/notes):

# xfsrestore -f /dev/tape -L week_1 -s people/fred/notes \
/usr/tmp

You 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 would overwrite 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

Network Restores

You can use standard network references to specify devices and files on the network. For example, to use the tape drive on a network host named magnolia as the source for a restore, you can use the command:

# 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.wpd.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 elapsed

In 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 “Dump and Restore With STDIN/STDOUT” for an example of using the standard input option of xfsrestore.

Interactive Restores

Use the –i option of xfsrestore to perform interactive file restoration. With interactive restoration, you can use the commands ls, pwd, and cd to peruse the filesystem, and the add and delete commands to create a list of files and subdirectories you want to restore. Then you can enter the extract command to restore the files, or quit to exit the interactive restore session without restoring files. (The use of “wildcards” is not allowed with these commands.)

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.

Cumulative Restores

Cumulative restores sequentially restore incremental dumps to recreate filesystems and are also used to restore interrupted dumps. To perform a cumulative restore of a filesystem, begin with the media object that contains the base level dump and recover it first, then recover the incremental dump with the next higher dump level number, then the next, and so on. Use the –r option to inform xfsrestore that you are performing a cumulative recovery.

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:

# xfsrestore -f /dev/tape -r -v silent .
xfsrestore: dump session found
xfsrestore: session label: "week_1"
xfsrestore: session id: d23cbcb4-b21d-1001-8f97-080069068eeb
xfsrestore: no media label
xfsrestore: media id: d23cbcb5-b21d-1001-8f97-080069068eeb
do you want to select this dump? (y/n): y
selected

Next, enter the same command again, but when prompted if you want to restore the first dump (which you've already restored), type n. Then type y in response to the continue searching question. When you come to the next dump, restore it:

# xfsrestore -f /dev/tape -r -v silent .
xfsrestore: dump session found
xfsrestore: session label: "week_1"
xfsrestore: session id: d23cbcb4-b21d-1001-8f97-080069068eeb
xfsrestore: no media label
xfsrestore: media id: d23cbcb5-b21d-1001-8f97-080069068eeb
do you want to select this dump? (y/n): n
not selected
do you want to continue searching? (y/n): y
continuing search
xfsrestore: dump session found
xfsrestore: session label: "week_2"
xfsrestore: session id: d23cbcb8-b21d-1001-8f97-080069068eeb
xfsrestore: no media label
xfsrestore: media id: d23cbcb5-b21d-1001-8f97-080069068eeb
do you want to select this dump? (y/n): y
selected
.
.
.

You then repeat this process, only now skipping the first two dumps and restoring the third, and so on, 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.

Restoring Interrupted Dumps

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”).

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.)

Interrupted Restores

In a manner similar to xfsdump interruptions, you can interrupt an xfsrestore session. This allows you to interrupt a restore session and then resume it later. To interrupt a restore session, type the interrupt character (typically CTRL-C). You receive a list of options which allow you to interrupt the session, change the verbosity level, or resume the session.

# xfsrestore -f /dev/tape -v silent /usr
xfsrestore: dump session found
xfsrestore: no session label
xfsrestore: session id: d23cbf44-b21d-1001-8f97-080069068eeb
xfsrestore: no media label
xfsrestore: media id: d23cbf45-b21d-1001-8f97-080069068eeb
do you want to select this dump? (y/n): y
selected
status: 92/168 files restored, 41.03 percent complete, 135 seconds elapsed
0: interrupt this session
1: change verbosity
2: continue
 -> 0
session interrupt initiated

Resume the xfsrestore session with the –R option:

# xfsrestore -f /dev/tape -R -v silent /usr

Data recovery continues from the point of the interruption.

The housekeeping and orphanage Directories

The xfsrestore utility can create two subdirectories in the destination called the housekeeping and orphanage directories.

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 will be displayed, and the file is placed in the orphanage directory, named with its original inode number.

Dump and Restore With STDIN/STDOUT

You can use xfsdump and xfsrestore to pipe data across filesystems or across the network with a single command line. By piping xfsdump standard output to xfsrestore standard input you create an exact copy of a filesystem.

For example, to make a copy of /usr/people/fred in the /usr2 directory, enter:

# xfsdump -J -s people/fred - /usr | xfsrestore - /usr2

To copy /usr/people/fred to the network host magnolia's /usr/tmp directory:

# xfsdump -J -s people/fred - /usr | rsh magnolia \
xfsrestore - /usr/tmp

This creates the directory /usr/tmp/people/fred on magnolia.


Note: The superuser account on the local system must be able to rsh to the remote system without a password. For more information, see hosts.equiv(4).


Other Backup Utilities and XFS

You can also use the standard IRIX utilities cpio(1), tar(1), and bru(1), to backup and restore data. This section discusses XFS-related issues in using these utilities.

tar

The -K option has been added to the tar(1) command for use with files larger than 2GB. If the -K option is not used, tar skips any files larger than 2GB and issues a warning. Note that use of this option can create tar archives that are not usable on non-XFS systems . The -K option cannot be used in combination with the -O option, which creates tar archives formatted in an older, pre-POSIX format.

cpio

The -K option has been added to the cpio(1) command for use with files larger than 2GB. If the -K option is not used, cpio skips any files larger than 2GB and issues a warning. Note that use of this option can create cpio archives that are not usable on non-XFS systems. The -K option can only be used in combination with the -o (output) option. The -K option cannot be used in combination with the -c option (which creates cpio archives with ASCII headers), nor with the -H option (used to specify various header formats).

bru

The -K option has been added to the bru(1) command for use with files larger than 2GB. If the -K option is not used, bru skips any files that it cannot compress to less than 2GB and issues a warning. Note that use of this option can create bru archives that are not usable on non-XFS systems. The -K option can only be used in combination with the -Z (use 12-bit LZW file compression) option.

System Recovery

The PROM Monitor's System Recovery option does not work correctly for XFS filesystems.



[1] For drives that do not permit termination to operate in this way, other means are used to achieve the same effective result.