mmclone command

Creates and manages file clones.

Synopsis

mmclone snap SourceFile [CloneParentFile]

or

mmclone copy CloneParentFile TargetFile

or

mmclone split Filename [Filename...]

or

mmclone redirect Filename [Filename...]

or

mmclone show Filename [Filename...]

Availability

Available on all IBM Spectrum Scale™ editions. Available on AIX® and Linux.

Description

Use the mmclone command to create and manage file clones. Clones are writable snapshots of individual files. Cloning a file is similar to creating a copy of a file, but the creation process is faster and more space efficient because no additional disk space is consumed until the clone or the original file is modified. The keyword specified after mmclone determines which action is performed:
snap
Creates a read-only snapshot of an existing file for the purpose of cloning. This read-only snapshot becomes known as the clone parent.
If only one file is specified with the mmclone snap command, it will convert that file to a clone parent without creating a separate clone parent file. When using this method to create a clone parent, the specified file cannot be open for writing or have hard links.
copy
Creates a file clone from a clone parent created with the mmclone snap command or from a file in a snapshot.
split
Splits a file clone from all clone parents.
redirect
Splits a file clone from the immediate clone parent only.
show
Displays the current status for one or more specified files. When a file is a clone, the report will show the parent inode number. When a file was cloned from a file in a snapshot, mmclone show displays the snapshot and fileset information.

The Depth field in the mmclone show output denotes the distance of the file from the root of the clone tree of which it is a member. The root of a clone tree has depth 0. This field is blank if the file in question is not a clone. This field is not updated when a clone’s ancestor is redirected or split from the clone tree. However, even if a clone’s ancestor has been split or redirected, the depth of the clone should always be greater than that of each of its ancestors.

The maximum depth for a clone tree is 1000.

Note: The mmclone command does not copy extended attributes.

If a snapshot has file clones, those file clones should be deleted or split from their clone parents prior to deleting the snapshot. Use the mmclone split or mmclone redirect command to split file clones. Use a regular delete (rm) command to delete a file clone. If a snapshot is deleted that contains a clone parent, any attempts to read a block that refers to the missing snapshot will return an error. A policy file can be created to help determine if a snapshot has file clones.

For more information about file clones and policy files, see the IBM Spectrum Scale: Administration Guide.

Parameters

SourceFile
Specifies the name of a file to clone.
CloneParentFile
When CloneParentFile is specified with a mmclone snap command, it indicates the name of the read-only clone parent that will be created from SourceFile.
When CloneParentFile is specified with a mmclone copy command, it indicates the name of a read-only clone parent. The CloneParentFile can be a clone parent created with the mmclone snap command or a file in a snapshot.
TargetFile
Specifies the name of the writable file clone that will be created from CloneParentFile.
Filename
Specifies the name of one or more files to split, redirect, or show.

Exit status

0
Successful completion.
nonzero
A failure has occurred.

Security

To run the mmclone command, you must have read access to the source file that will be cloned, and write access to the directory where the file clone will be created.

Examples

  1. To create a clone parent called base.img from a file called test01.img, issue this command:
    mmclone snap test01.img base.img
    To use this clone parent to create a file clone called test02.img, issue this command:
    mmclone copy base.img test02.img
    After the file clone is created, use the mmclone show command to show information about all img files in the current directory:
    mmclone show *.img
    The system displays output similar to the following:
    Parent  Depth   Parent inode   File name
    ------  -----  --------------  ---------
       yes      0                  base.img
        no      1          148488  test01.img
        no      1          148488  test02.img
  2. To create a file clone called file1.clone from a file called file1 in the snap1 snapshot, issue this command:
    mmclone copy /fs1/.snapshots/snap1/file1 file1.clone

Location

/usr/lpp/mmfs/bin