snapshot Command

Purpose

Modify, create or view properties of enhanced journaled file system (JFS2) snapshots.

Syntax

To Create an External Snapshot

snapshot -o snapfrom=snappedFS snapshotLV

snapshot -o snapfrom=snappedFS -o size=Size

To Create an Internal Snapshot

snapshot -o snapfrom=snappedFS -n snapshotName

To Delete an External Snapshot

snapshot -d snapshotLV

To Delete an Internal Snapshot

snapshot -d -n snapshotName snappedFS

To Query a JFS2 File System

snapshot -q [ -cfieldSeparator ] snappedFS

To Query an External Snapshot

snapshot -q [ -cfieldSeparator ] snapshotLV

To Query an Internal Snapshot

snapshot -q -n snapshotName [ -cfieldSeparator ] snappedFS

To Modify an External Snapshot

snapshot -o size=Size snapshotLV

Note: The snapshot command does not support modifying internal snapshots. The size of an internal snapshot is limited by the amount of free space available in the file system itself.

Description

This command provides an interface to JFS2 snapshots.

The maximum number of external snapshots per file system is 15, while the maximum number of internal snapshots per file system is 64.

You cannot have both internal snapshot and external snapshot of a file system at the same time.

Flags

Item Description
-c fieldSeparator Specifies the output from the snapshot query to be displayed in colon format. The fieldSeparator is the character to use to separate the fields of the display.
-d Deletes the snapshot and any previous snapshots. If the snapshot is an external snapshot, the logical volume containing the snapshot is also deleted unless you specify the -s flag. For an external snapshot, the snapshotLV parameter specifies the snapshot to delete. For an internal snapshot, the snappedFS parameter specifies the file system containing the snapshot to delete. The -n flag specifies the name of the snapshot to delete.
-n snapshotName Specifies the access point for the internal snapshot under the snappedFS/.snapshot/snapshotName. If you specify the -n flag when creating a snapshot, the file system specified by the snappedFS parameter must be enabled for internal snapshots. Otherwise, an error message is displayed and no snapshot is created. To enable a file system to use internal snapshots, specify the isnapshot option when you create the file system with the mkfs command (-o isnapshot={yes}) or the crfs command (-a isnapshot = {yes} ).
-o snapfrom=snappedFS Creates a snapshot of the file system specified by the snappedFS parameter. If the -n flag is specified, an internal snapshot is created. If the snapshotLV parameter is specified, the logic volume must already exist and must be in the same volume group as the file system specified by the snappedFS parameter. If the specified logic volume is already in use as a snapshot or a file system known to the /etc/filesystems file, the command issues an error message and fails. If the -n flag and the snapshotLV parameter are not specified, a new logical volume is created for the external snapshot.
-o size=Size Specifies the size of a new logical volume for an external snapshot when you specify this flag with the -o snapfrom=snappedFS flag. Otherwise, this flag increases the size of the external snapshot specified by the snapshotLV field to the value of Size. This flag is ignored if any flag other given. If the Size field is followed by an M, the value is treated as megabytes. If the Size field is followed by a G, the value is treated as gigabytes. If neither M nor G are used, the value is treated as 512-byte blocks.
-q
Displays information about the specified snapshot or snapshots. Specifies the following flags and options to determine the query as needed:
  • Specify the -n flag to display information about the named internal snapshot belonging to the file system that is specified by the snappedFS parameter is displayed. The information includes the file system that the snapshot belongs to, and the time when the snapshot is taken.
  • Specify the snapshotLV parameter to display information about the external snapshot. The information includes the file system that the snapshot belongs to, the time when the snapshot is taken, the size of the snapshot storage object, and the remaining free space.
  • Specify the snappedFS parameter to display information about all of the snapshots for the file system specified by the snappedFS parameter. For external snapshots, the information includes each of the snapshots and their storage objects, the time when the snapshot is taken, the size of the snapshot storage objects, and the remaining free space. For internal snapshots, the information includes each of the snapshots and the time when the snapshot is taken.
-s Retains the specified logical volume for the specified snapshot when the external snapshot is deleted.

Parameters

Item Description
fieldSeparator The character to use to separate the fields of the display.
snappedFS The JFS2 file system to act on for snapshot creation, deletion, or query.
snapshotLV The logical volume of the external snapshot.

Security

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in AIX® Version 7.1 Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

Examples

  1. To create a snapshot for the /home/janet/sb file system on the /dev/snapsb logical volume, enter the following:
    snapshot -o snapfrom=/home/janet/sb /dev/snapsb
    This command creates a snapshot for the /home/janet/sb file system on the /dev/snapsb logical volume, which already exists.
  2. To create a snapshot for the /home/janet/sb file system, enter the following:
     snapshot -o snapfrom=/home/janet/sb -o size=16M
    This command creates a 16-megabyte logical volume and creates a snapshot for the /home/janet/sb file system on the newly created logical volume.
  3. To view information about all of the snapshots for the /home/janet/sb file system, enter the following:
    snapshot -q /home/janet/sb
    This command displays each snapshot for the /home/janet/sb file system along with the time when the snapshot was taken, the size of the snapshot storage object, and the remaining free space.
  4. To increase the size of the snapshot on the /dev/snapsb device, enter the following:
    snapshot -o size=64M /dev/snapsb
    This command increases the /dev/snapsb device to 64 megabytes along with the snapshot contained on the device.
  5. To delete the snapshot on the /dev/snapsbdevice, enter the following:
    snapshot -d /dev/snapsb
    This command deletes the snapshot contained on the /dev/snapsb device and removes the /dev/snapsb logical volume .