Linking to a snapshot

Snapshot root directories appear in a special .snapshots directory under the file system root.

If you prefer to link directly to the snapshot rather than always traverse the root directory, you can use the mmsnapdir command with the -a option to add a .snapshots subdirectory to all directories in the file system. These .snapshots subdirectories will contain a link into the corresponding directory for each snapshot that includes the directory in the active file system.

Unlike .snapshots in the root directory, however, the .snapshots directories added by the -a option of the mmsnapdir command are invisible in the sense that the ls command or readdir() function does not return .snapshots. This is to prevent recursive file system utilities such as find or tar from entering into the snapshot tree for each directory they process. For example, if you enter ls -a /fs1/userA, the .snapshots directory is not listed. However, you can enter ls /fs1/userA/.snapshots or cd /fs1/userA/.snapshots to confirm that .snapshots is present. If a user wants to make one of their snapshot directories more visible, it is suggested to create a symbolic link to .snapshots.

The inode numbers that are used for and within these special .snapshots directories are constructed dynamically and do not follow the standard rules. These inode numbers are visible to applications through standard commands, such as stat, readdir, or ls. The inode numbers reported for these directories can also be reported differently on different operating systems. Applications should not expect consistent numbering for such inodes.

Specifying the -r option on the mmsnapdir command reverses the effect of the -a option, and reverts to the default behavior of a single .snapshots directory in the root directory.

The -s option allows you to change the name of the .snapshots directory. For complete usage information, see mmsnapdir command.

To illustrate this point, assume that a GPFS file system called fs1, which is mounted at /fs1, has one snapshot called snap1. The file system might appear similar to this:
/fs1/userA/file2b
/fs1/userA/file3b
/fs1/.snapshots/snap1/userA/file2b
/fs1/.snapshots/snap1/userA/file3b
To create links to the snapshots from each directory, and instead of .snapshots, use the name .links, enter:
mmsnapdir fs1 -a -s .links
After the command completes, the directory structure would appear similar to:
/fs1/userA/file2b
/fs1/userA/file3b
/fs1/userA/.links/snap1/file2b
/fs1/userA/.links/snap1/file3b

/fs1/.links/snap1/userA/file2b
/fs1/.links/snap1/userA/file3b
To delete the links, issue:
mmsnapdir fs1 -r
After the command completes, the directory structure is similar to the following:
/fs1/userA/file2b
/fs1/userA/file3b

/fs1/.links/snap1/userA/file2b
/fs1/.links/snap1/userA/file3b

For complete usage information, see mmsnapdir command.