mmcrsnapshot command
Creates a snapshot of a file system or fileset at a single point in time.
Synopsis
mmcrsnapshot Device [[Fileset]:]Snapshot[,[[Fileset]:]Snapshot[-j FilesetName[,FilesetName...]] [--expiration-time yyyy-mm-dd-hh:mm[:ss]]
Availability
Available on all IBM Storage Scale editions.
Description
Use the mmcrsnapshot command to create global snapshots or fileset snapshots at a single point in time. System data and existing snapshots are not copied. The snapshot function allows a backup or mirror program to run concurrently with user updates and still obtain a consistent copy of the file system as of the time the copy was created. Snapshots also provide an online backup capability that allows easy recovery from common problems such as accidental deletion of a file, and comparison with older versions of a file.
In IBM Storage Scale Release 4.2.1 and later, snapshot commands support the specification of multiple snapshots. Users can easily create and delete multiple snapshots. Also, system performance is increased by batching operations and reducing overhead.
# mmcrsnapshot device [[Fileset]:]Snapshot[,[[Fileset]:]Snapshot...]
# mmcrsnapshot device [[Fileset]:]Snapshot[,[[Fileset]:]Snapshot...] -j Fileset
# mmcrsnapshot device Snapshot -j Fileset1,Fileset2,...
A global snapshot is an exact copy of changed data in the active files and directories of a file system. Snapshots of a file system are read-only and they appear in a .snapshots directory located in the file system root directory. The files and attributes of the file system can be changed only in the active copy.
A fileset snapshot is an exact copy of changed data in the active files and directories of an independent fileset plus all dependent filesets. Fileset snapshots are read-only and they appear in a .snapshots directory located in the root directory of the fileset. The files and attributes of the fileset can be changed only in the active copy.
Snapshots may be deleted only by issuing the mmdelsnapshot command. The .snapshots directory cannot be deleted, though it can be renamed with the mmsnapdir command using the -s option.
Because global snapshots are not full, independent copies of the entire file system, they should not be used as protection against media failures. For information about protection against media failures, see Recoverability considerations.
For more information on global snapshots, see Creating and maintaining snapshots of file systems.
For more information on fileset snapshots, see Fileset-level snapshots.
Parameters
- Device
- The device name of the file system for which the snapshot is to
be created. File system names need not be fully-qualified. fs0 is
just as acceptable as /dev/fs0.
This must be the first parameter.
- Fileset
- The name of the fileset that contains the fileset snapshot to
be created. If Fileset is not specified, the mmcrsnapshot command
creates a global snapshot named Snapshot.Note: Ensure that multiple snapshots and multiple filesets are not used together.
- Snapshot
- Specifies the name given to the snapshot.
The snapshot names are separated by a comma.
The snapshot specifier describes global and fileset snapshots. For example, Fileset1:Snapshot1 specifies a fileset snapshot named Snapshot1 for fileset Fileset1. If Fileset1 is empty, Snapshot1 is a global snapshot named Snapshot1.
Each global snapshot name must be unique from any other global snapshots. If you do not want to traverse the root of the file system to access the global snapshot, a more convenient mechanism that enables a connection in each directory of the active file system can be enabled with the -a option of the mmsnapdir command.Note: Ensure that the snapshot name is using the "@GMT-yyyy.MM.dd-HH.mm.ss" format in order to be identifiable by the Windows VSS.For a fileset snapshot, Snapshot appears as a subdirectory of the .snapshots directory in the root directory of the fileset. Fileset snapshot names can be duplicated across different filesets. A fileset snapshot can also have the same name as a global snapshot. The mmsnapdir command provides an option to make global snapshots also available through the .snapshots in the root directory of all independent filesets.Note:- Ensure that the snapshot name does not include a colon (:) and a comma (,).
- Ensure that multiple snapshots and multiple filesets are not used together.
- -j FilesetName
- Creates a snapshot that includes the specified fileset and all
the dependent filesets that share the same inode space. FilesetName refers
to an independent fileset. If -j is not
specified, the mmcrsnapshot command creates
a global snapshot that includes all filesets.
If -j is specified, fileset names can be considered as a list separated by commas.
Note:- When a list of snapshots separated by a comma (,) is used with the -j option, the fileset is applicable to each snapshot that does not use the colon (:) syntax. The fileset name must not consist of a white space.
- Only one global snapshot and one snapshot can be specified in each fileset. Therefore, multiple snapshots must not be created with the -j option. IBM® recommends that at the most one global snapshot and one fileset snapshot must be included in each independent fileset. If multiple snapshots are specified with the -j option, a snapshot with the same name is created for each fileset that has been listed.
- --expiration-time
- Specifies the expiration time of a snapshot for which the retention period is defined. The
expiration time includes both the date and time and appears in the following format
yyyy-mm-dd-hh:mm[:ss]. The snapshot cannot be deleted before the retention
period expires. The defined time must be at least 10 minutes later than the current time. The
maximum duration for the defined time is 365 days from the current time. For example, if the current
time is 2022-07-20-20:49:00, then the valid range for the expiration time is
2022-07-20-20:59:00―2023-07-20-20:49:00.
Default snapshots, for which retention period is not defined, can be deleted any time after creation. The expiry time for all default snapshots is the same as their creation time.
You can view the defined expiration time in the mmlssnapshot command output. A sample output displaying two global snapshots and two fileset snapshots with retention periods defined for one global and one fileset snapshots is shown.Snapshots in file system gpfs2: Directory SnapId Status Created ExpirationTime Fileset gsnap1 1 Valid Mon Jul 4 22:49:17 2022 Mon Jul 4 22:49:17 2022 gsnap2 20 Valid Tue Jul 26 06:00:00 2022 Mon Aug 8 12:00:00 2022 fset1-snap1 21 Valid Tue Jul 26 06:00:40 2022 Tue Jul 26 06:00:40 2022 fset1 fset1-snap2 22 Valid Tue Jul 26 06:01:07 2022 Fri Sep 9 12:00:00 2022 fset1
Note:- It is optional to provide the value for [:ss] in the expiration time duration.
- If multiple snapshots are created in a single command line then they share the same expiration time.
- The --expiration-time option is available only when you upgrade the file system to format version 5.1.5 or later, or when you create the file system with version 5.1.5 or later.
Exit status
- 0
- Successful completion.
- nonzero
- A failure has occurred.
Security
You must have root authority to run the mmcrsnapshot command when creating global snapshots.
Independent fileset owners can run the mmcrsnapshot command to create snapshots of the filesets they own.
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
- To create a global snapshot snap1, for the file system fs1, issue the following command:
A sample output is as follows:# mmcrsnapshot fs1 snap1
Writing dirty data to disk. Quiescing all file system operations. Writing dirty data to disk again. Snapshot snap1 created with id 1.
Before issuing the command, the directory structure would appear similar to:/fs1/file1 /fs1/userA/file2 /fs1/userA/file3
After the command has been issued, the directory structure would appear similar to:/fs1/file1 /fs1/userA/file2 /fs1/userA/file3 /fs1/.snapshots/snap1/file1 /fs1/.snapshots/snap1/userA/file2 /fs1/.snapshots/snap1/userA/file3
If a second snapshot were to be created at a later time, the first snapshot would remain as is. Snapshots are made only of active file systems, not existing snapshots. For example:
A sample output is as follows:# mmcrsnapshot fs1 snap2
Writing dirty data to disk. Quiescing all file system operations. Writing dirty data to disk again. Snapshot snap2 created with id 2.
After the command has been issued, the directory structure would appear similar to:/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/userA/file2 /fs1/.snapshots/snap2/userA/file3
- To create a snapshot Snap3 of the fileset
FsetF5-V2 for the file system fs1, issue the
following command:
A sample output is as follows:# mmcrsnapshot fs1 Snap3 -j FsetF5-V2
To display the snapshot that contains the FsetF5-V2 fileset, issue the following command:Writing dirty data to disk. Quiescing all file system operations. Writing dirty data to disk again. Snapshot Snap3 created with id 69.
A sample output is as follows:# mmlssnapshot device -j FsetF5-V2
Snapshots in file system fs1: Directory SnapId Status Created Fileset Snap3 69 Valid Wed Feb 1 12:55:51 2012 FsetF5-V2
- To create a snapshot of the gpfs0 file system that can be viewed over SMB protocol with Windows VSS, issue the following
command:
A sample output is as follows:# mmcrsnapshot gpfs0 $(date --utc +@GMT-%Y.%m.%d-%H.%M.%S)
mmcrsnapshot gpfs0 $(date --utc +@GMT-%Y.%m.%d-%H.%M.%S) Flushing dirty data for snapshot @GMT-2015.10.02-21.03.33... Quiescing all file system operations. Snapshot @GMT-2015.10.02-21.03.33 created with id 7.
- To create a snapshot for the fset1, fset2, fset3 filesets for the file system
fs1, run the following
command:
A sample output is as follows:# mmcrsnapshot fs1 snap1 -j fset1,fset2,fset3
Flushing dirty data for snapshot fset1:snap1 fset2:snap1 fset3:snap1 (1..3) of 3... Quiescing all file system operations. Snapshot fset1:snap1 created with id 1. Snapshot fset2:snap1 created with id 2. Snapshot fset3:snap1 created with id 3.
- To specify different snapshot names for each fileset (fset1, fset2, and fset3) for the file
system fs1, run the following
command:
A sample output is as follows:# mmcrsnapshot fs1 fset1:snapA,fset2:snapB,fset3:snapC
To view the list of snapshots, run the following command:Flushing dirty data for snapshot fset1:snapA fset2:snapB fset3:snapC (1..3) of 3... Quiescing all file system operations. Snapshot fset1:snapA created with id 4. Snapshot fset2:snapB created with id 5. Snapshot fset3:snapC created with id 6.
A sample output is as follows:# mmlssnapshot fs1
Snapshots in file system fs1: Directory SnapId Status Created Fileset snap1 1 Valid Thu May 12 04:27:18 2016 fset1 snap1 2 Valid Thu May 12 04:27:18 2016 fset2 snap1 3 Valid Thu May 12 04:27:18 2016 fset3 snapA 4 Valid Thu May 12 04:28:33 2016 fset1 snapB 5 Valid Thu May 12 04:28:33 2016 fset2 snapC 6 Valid Thu May 12 04:28:33 2016 fset3