mmrestorefs command

Restores a file system or an independent fileset from a snapshot.

Synopsis

mmrestorefs Device SnapshotName [-j FilesetName]
            [-N {Node[,Node...] | NodeFile | NodeClass}]
            [--log-quiet] [--preserve-encryption-attributes]
            [--suppress-external-attributes] [--threads MaxNumThreads]
            [--work-unit FilesPerThread]             

Availability

Available with IBM Spectrum Scale™ Standard Edition or higher. Available on AIX® and Linux.

Description

Use the mmrestorefs command to restore user data and attribute files to a file system or an independent fileset using those of the specified snapshot. Data will be restored by mmrestorefs without regard for file system or fileset quotas unless the enforceFilesetQuotaOnRoot configuration attribute of the mmchconfig command is set to yes. The mmrestorefs command does not restore the file system and fileset quota configuration information.

In versions before IBM Spectrum Scale 4.1.1, ensure that the file system is unmounted before you run the mmrestorefs command. For more information, see Table 1 and Table 2 below. When restoring from an independent fileset snapshot (using the -j option), link the fileset from nodes in the cluster that are to participate in the restore. It is preferable to run the mmrestorefs command when there are no user operations (either from commands, applications, or services) in progress on the file system or fileset. If there are user operations in progress on the file system or fileset while mmrestorefs is running, the restore might fail. For these failures, stop the user operations and run the mmrestorefs command again to complete the restore. For better performance, run the mmrestorefs command when the system is idle. While the restore is in progress, do not unlink the fileset, unmount the file system, or delete the fileset, fileset snapshot, or file system.

The mmrestorefs command cannot restore a fileset that was deleted after a global snapshot was created. In addition, the filesets in a global snapshot that are in deleted or unlinked state cannot be restored.

Snapshots are not affected by the mmrestorefs command. When a failure occurs during a restore, try repeating the mmrestorefs command except when there are ENOSPC or quota exceeded errors. In these cases, fix the errors then try the mmrestorefs command again.

For information on how GPFS™ policies and snapshots interact, see the IBM Spectrum Scale: Administration Guide.

Because snapshots are not copies of the entire file system, they should not be used as protection against media failures. For protection against media failures, see the IBM Spectrum Scale: Concepts, Planning, and Installation Guide and search on "recoverability considerations".

The mmrestorefs command can cause a compressed file in the active file system to become decompressed if it is overwritten by the restore process. To recompress the file, run the mmrestripefile command with the -z option.

CAUTION:
  • Do not run file compression or decompression while an mmrestorefs command is running. This caution applies to compression or decompression with the mmchattr command or with the mmapplypolicy command.
  • Do not run the mmrestripefs or mmrestripefile command while an mmrestorefs command is running.
Note: The following table shows the requirements and the results when you restore a global snapshot:
Table 1. Restoring a global snapshot
The product version level of the node that runs the mmrestorefs command The file system must be in this state Results
Before V4.1.1 Unmounted The file system manager performs the restore.
V4.1.1 or later Mounted By default the restore is performed on all nodes running V4.1.1 or later.
The following table shows the requirements and the results when you restore a fileset snapshot:
Table 2. Restoring a fileset snapshot
The product version level of the node that runs the mmrestorefs command The file system must be in this state Results
V3.5 Unmounted The file system manager performs the restore.
V4.1.1 or later Mounted By default the restore is performed on all nodes running V4.1.1 or later.

Parameters

Device
The device name of the file system that contains the snapshot to use for the restore. File system names need not be fully-qualified. fs0 is just as acceptable as /dev/fs0.

This must be the first parameter.

SnapshotName
Specifies the name of the snapshot that will be used for the restore.
-j FilesetName
Specifies the name of a fileset covered by this snapshot.
-N {Node[,Node...] | NodeFile | NodeClass}
Specifies the nodes that are to participate in the restore. The default is all or the current value of the defaultHelperNodes parameter of the mmchconfig command.

Starting with IBM Spectrum Scale 4.1.1, -N can be used for both fileset and global snapshot restores. (In GPFS 4.1, -N can be used for fileset snapshot restore only. In GPFS 3.5 and earlier, there is no -N parameter.)

For general information on how to specify node names, see Specifying nodes as input to GPFS commands.

--log-quiet
Suppresses detailed thread log output.
--preserve-encryption-attributes
Preserves the encryption extended attributes. Files that were removed after the snapshot was taken are restored with the same encryption attributes (including FEK) of the file in the snapshot. If this option is not used, the file is recreated with the encryption policy in place at the time the file is restored.
--suppress-external-attributes
Specifies that external attributes will not be restored.
--threads MaxNumThreads
Specifies the maximum number of concurrent restore operations. The default is 24.
--work-unit FilesPerThread
Specifies the number of files each thread will process at a time. The default is 100.

Exit status

0
Successful completion.
nonzero
A failure has occurred.

Security

You must have root authority to run the mmrestorefs command.

The node on which the command is issued must be able to execute remote shell commands on any other node in the cluster without the use of a password and without producing any extraneous messages.For more information, see Requirements for administering a GPFS file system.

Examples

Suppose that you have the following directory structure:
/fs1/file1
/fs1/userA/file2
/fs1/userA/file3

/fs1/.snapshots/snap1/file1
/fs1/.snapshots/snap1/userA/file2
/fs1/.snapshots/snap1/userA/file3
The directory userA is then deleted, leaving the following structure:
/fs1/file1

/fs1/.snapshots/snap1/file1
/fs1/.snapshots/snap1/userA/file2
/fs1/.snapshots/snap1/userA/file3
The directory userB is then created using the inode originally assigned to userA, and another snapshot is taken:
mmcrsnapshot fs1 snap2
The output is similar to this:
Writing dirty data to disk.
Quiescing all file system operations.
Writing dirty data to disk again.
Snapshot snap2 created with id 2.
The directory structure is similar to the following:
/fs1/file1
/fs1/userB/file2b
/fs1/userB/file3b

/fs1/.snapshots/snap1/file1
/fs1/.snapshots/snap1/userA/file2
/fs1/.snapshots/snap1/userA/file3

/fs1/.snapshots/snap2/file1
/fs1/.snapshots/snap2/userB/file2b
/fs1/.snapshots/snap2/userB/file3b
The file system is then restored from snap1:
mmrestorefs fs1 snap1
The resulting directory structure is similar to the following:
/fs1/file1
/fs1/userA/file2
/fs1/userA/file3

/fs1/.snapshots/snap1/file1
/fs1/.snapshots/snap1/userA/file2
/fs1/.snapshots/snap1/userA/file3

/fs1/.snapshots/snap2/file1
/fs1/.snapshots/snap2/userB/file2b
/fs1/.snapshots/snap2/userB/file3b

Location

/usr/lpp/mmfs/bin