logo

Manual Pages


Table of Contents

NAME

na_snap - manage snapshots

SYNOPSIS

snap autodelete vol_name [ on | off | show | reset | help ]
snap autodelete vol_name option value

snap create [ -A | -V ] vol_name name

snap delete [ -A | -V ] vol_name name snap delete [ -A | -V ] -a [ -f ] [ -q ] vol_name

snap delta [ -A | -V ] [ vol_name [ snap ] [ snap ] ]

snap list [ -A | -V ] [ -n ] [ -l ] [ -b ] [ [ -q ] [ vol_name ] | -o [ qtree_path ] ]

snap reclaimable vol_name snap ...

snap rename [ -A | -V ] vol_name old-snapshot-name new-snapshot-name

snap reserve [ -A | -V ] [ vol_name [ percent ] ]

snap restore [ -A | -V ] [ -f ] [ -t vol | file ] [ -s snapshot_name ]
[ -r restore_as_path ] vol_name | restore_from_path

snap sched [ -A | -V ] [ vol_name [ weeks [ days [ hours[@list] ] ] ] ]

DESCRIPTION

The snap family of commands provides a means to create and manage snapshots in each volume or aggregate.

A snapshot is a read-only copy of the entire file system, as of the time the snapshot was created. The filer creates snapshots very quickly without consuming any disk space. The existing data remains in place; future writes to those blocks are redirected to new locations. Only as blocks in the active file system are modified and written to new locations on disk does the snapshot begin to consume extra space.

Volume snapshots are exported to all CIFS or NFS clients. They can be accessed from each directory in the file system. From any directory, a user can access the set of snapshots from a hidden sub-directory that appears to a CIFS client as ~snapsht and to an NFS client as .snapshot. These hidden sub-directories are special in that they can be accessed from every directory, but they only show up in directory listings at an NFS mount point or at the root of CIFS share.

Each volume on the filer can have up to 255 snapshots at one time. Each aggregate on the filer can have up to 10 snapshots at one time if snapshot autodelete is enabled on that aggregate. If autodelete is not enabled the aggregate can have up to 255 snapshots. Because of the technique used to update disk blocks, deleting a snapshot will generally not free as much space as its size would seem to indicate. Blocks in the snapshot may be shared with other snapshots, or with the active file system, and thus may be unavailable for reuse even after the snapshot is deleted.

If executed on a vfiler, the snap command can only operate on volumes of which the vfiler has exclusive ownership. Manipulating snapshots in shared volumes can only be performed on the physical filer. Operations on aggregate snapshots are unavailable on vfilers and must be performed on the physical filer. For the rest of this section, if the snap command is executed on a vfiler, all volume names passed on the command line must belong to the vfiler exclusively.

The snap commands are persistent across reboots. Do not include snap commands in the /etc/rc. If you include a snap command in the /etc/rc file, the same snap command you enter through the command line interface does not persist across a reboot and is overridden by the one in the /etc/rc file.

Automatic snapshots
Automatic snapshots can be scheduled to occur weekly, daily, or hourly. Weekly snapshots are named weekly.N, where N is "0" for the most recent snapshot, "1" for the next most recent, and so on. Daily snapshots are named daily.N and hourly snapshots hourly.N. Whenever a new snapshot of a particular type is created and the number of existing snapshots of that type exceeds the limit specified by the sched option described below, then the oldest snapshot is deleted and the existing ones are renamed. If, for example, you specified that a maximum of 8 hourly snapshots were to be saved using the sched command, then on the hour, hourly.7 would be deleted, hourly.0 would be renamed to hourly.1, and so on. If deletion of the oldest snapshot fails because it is busy, the oldest snapshot is renamed to scheduled_snap_busy.N , where N is a unique number identifying the snapshot. Once the snapshot is no longer busy, it will be deleted. Do not use snapshot names of this form for other purposes, as they may be deleted automatically.

USAGE

All of the snap commands take the options -A and -V. The first specifies that the operation should be performed on an aggregate, and the following name is taken to be the name of an aggregate. The second specifies a volume-level operation. This is the default. The -A option is not available on vfilers.

snap autodelete volname [ on | off | reset | show | help ]

snap autodelete volname option value ... Snap autodelete allows a flexible volume to automatically delete the snapshots in the volume. This is useful when a volume is about to run out of available space and deleting snapshots can recover space for current writes to the volume. This feature works together with vol autosize to automatically reclaim space when the volume is about to get full. The volume option try_first controls the order in which these two reclaim policies are used.

By default autodelete is disabled. The on sub-command can be used to enable autodelete. The reset sub-command resets the settings of the snap autodelete to defaults. The show sub-command can be used to view the current settings.

The snapshots in a volume are deleted in accordance to a policy defined by the option settings. The currently supported options:

commitment { try | disrupt | destroy }

This option determines whether a particular snapshot is allowed to be deleted by autodelete. Setting this option to try permits snapshots which are not locked by data protection utilities (e.g. dump, mirroring, NDMPcopy) and data backing functionalities (e.g. volume and LUN clones) to be deleted. Snapvault snapshots are not locked and thus are not protected from autodelete by the try option. Setting this option to disrupt permits snapshots which are not locked by data backing functionalities to be deleted in addition to those which the try option allows to be deleted. Setting this option to destroy in conjunction with the destroy_list option allows autodelete of snapshots that are locked by data backing functionalities (e.g. LUN clone). Since the values for the commitment option are hierarchical, setting it to destroy will allow destruction of the snapshots which the try and disrupt options allow to be deleted.

destroy_list { none | lun_clone | vol_clone cifs_share }

This option, when used with the commitment destroy option, determines which types of locked snapshots can be autodeleted. Setting the option to none prevents all snapshots from being autodeleted. Setting the option to lun_clone allows snapshots locked by LUN clones to be autodeleted. Setting the option to vol_clone allows snapshots locked by volume clones to be autodeleted. Setting the option to cifs_share allows snapshots locked by CIFS shares to be autodeleted. These options have no effect unless the commitment option is also set to destroy. Multiple comma-separated options can be combined (except none). The following is an example of the destroy_list being set on a filer when the commitment option is not set to destroy:

  host01> snap autodelete test_vol destroy_list lun_clone
  WARNING: Make sure commitment option is set to destroy, to make use of this feature

  snap autodelete: snap autodelete configuration options set

  host01> snap autodelete test_vol commitment destroy
  snap autodelete: snap autodelete configuration options set

trigger { volume | snap_reserve | space_reserve }

This option determines the condition which starts the automatic deletion of snapshots. Setting the option to volume triggers snapshot delete when the volume reaches 98% capacity and the volume's snap reserve has been exceeded. Setting the option to snap_reserve triggers snapshot delete when the snap reserve of the volume reaches 98% capacity. Setting the option to space_reserve triggers snapshot delete when the space reserved in the volume reaches 98% capacity and the volume's snap reserve has been exceeded.

target_free_space value

This option determines the condition when snapshot autodeletion should stop (once started). The value is a percentage. Depending on the trigger, snapshots are deleted till the free space reaches the target_free_space percentage.

delete_order { newest_first | oldest_first }

This option determines if the oldest or newest snapshots will be deleted first.

defer_delete { scheduled | user_created prefix | none }

This deletion of a particular kind of snapshot can be defered to the end. Setting this option value to scheduled will delete the snapshots created by the snapshot scheduler last. Setting this option value to user_created will delete the snapshots not created by the scheduler last. Setting it to prefix will delete the snapshots matching the prefix string (see option prefix) to be deleted last. Setting the option to none will set all snapshot eligible for deletion right away.

prefix string

The option value sets the prefix for the prefix setting for option defer_delete. The prefix string can be 15 char long.

snap create vol_name snapshot-name Creates a snapshot of volume vol_name with the specified name.

snap delete vol_name name
Deletes the existing snapshot belonging to volume vol_name that has the specified name.

snap delete -a [ -f ] [ -q ] vol_name Deletes all existing snapshots belonging to volume vol_name. Before beginning deletion, the user is requested to confirm the operation. The -f option suppresses this confirmation step. A message is printed out to indicate each snapshot deleted, unless the -q option is specified, in which case deletion will occur silently. This command can be interrupted by entering CTRL-C. Note that certain filer utilities, such as RAID sync mirror, need to lock snapshots periodically to temporarily prevent snapshot deletion. In such a case, all snapshots may not be deleted by snap delete -a. The snap delete command prints the list of owners of all busy snapshots (snapshots which have other applications/systems locking them).

snap delta [ vol_name [ snapshot-name ] [ snap_shot-name ]]
Displays the rate of change of data between snapshots. When used without any arguments it displays the rate of change of data between snapshots for all volumes in the system, or all aggregates in the case of snap delta -A. If a volume is specified, the rate of change of data is displayed for that particular volume. The query can be made more specific by specifying the beginning and ending snapshots to display the rate of change between them for a specific volume. If no ending snapshot is listed, the rate of change of data between the beginning snapshot and the Active File System is displayed.

The rate of change information is displayed in two tables. In the first table each row displays the differences between two successive snapshots. The first row displays the differences between the youngest snapshot in the volume and the Active File System. Each following row displays the differences between the next older snapshot and the previous snapshot, stepping through all of the snapshots in the volume until the information for the oldest snapshot is displayed. Each row displays the names of the two snapshots being compared, the amount of data that changed between them, how long the first snapshot listed has been in existence, and how fast the data changed between the two snapshots.

The second table shows the summarized rate of change for the volume between the oldest snapshot and the Active File System.

snap delta run on a volume

  toaster> snap delta vol0

  Volume vol0
  working...

  From Snapshot   To                   KB changed  Time         Rate (KB/hour)
  --------------- -------------------- ----------- ------------ ---------------
  hourly.0        Active File System   149812        0d 03:43   40223.985
  hourly.1        hourly.0             326232        0d 08:00   40779.000
  hourly.2        hourly.1             2336          1d 12:00   64.888
  hourly.3        hourly.2             1536          0d 04:00   384.000
  hourly.4        hourly.3             1420          0d 04:00   355.000
  nightly.0       hourly.4             1568          0d 12:00   130.666
  hourly.5        nightly.0            1400          0d 04:00   350.000
  nightly.1       hourly.5             10800       201d 21:00   2.229

  Summary...

  From Snapshot   To                   KB changed  Time         Rate (KB/hour)
  --------------- -------------------- ----------- ------------ ---------------
  nightly.1       Active File System   495104      204d 20:43   100.697

  toaster>

snap delta from nightly.0 to hourly.1
  toaster> snap delta vol0 nightly.0 hourly.1

  Volume vol0
  working...

  From Snapshot   To                   KB changed  Time         Rate (KB/hour)
  --------------- -------------------- ----------- ------------ ---------------
  hourly.2        hourly.1             2336          1d 12:00   64.888
  hourly.3        hourly.2             1536          0d 04:00   384.000
  hourly.4        hourly.3             1420          0d 04:00   355.000
  nightly.0       hourly.4             1568          0d 12:00   130.666

  Summary...

  From Snapshot   To                   KB changed  Time         Rate (KB/hour)
  --------------- -------------------- ----------- ------------ ---------------
  nightly.0       hourly.1             6860          2d 08:00   122.500

  toaster>

snap list [ -n ] [ vol_name ] Displays a single line of information for each snapshot. Along with the snapshot's name, it shows when the snapshot was created and the size of the snapshot. If you include the vol_name argument, list displays snapshot information only for the specified volume. With no arguments, it displays snapshot information for all volumes in the system, or all aggregates in the case of snap list -A. If you supply the -n option, the snapshot space consumption (%/used and %/total) will not be displayed. This option can be helpful if there is a single file snap restore in progress, as the space information may take a substantial time to compute during the restore.The %/used column shows space consumed by snapshots as a percentage of disk space being used in the volume. The %/total column shows space consumed by snapshots as a percentage of total disk space (both space used and space available) in the volume. The first number is cumulative for all snapshots listed so far, and the second number in parenthesis is for the specified snapshot alone.

The following is an example of the snap list output on a filer with two volumes named engineering and marketing.

  Volume engineering

    %/used       %/total  date          name
  ----------  ----------  ------------  --------
    0% ( 0%)    0% ( 0%)  Nov 14 08:00  hourly.0
   50% (50%)    0% ( 0%)  Nov 14 00:00  nightly.0
   67% (50%)    0% ( 0%)  Nov 13 20:00  hourly.1
   75% (50%)    0% ( 0%)  Nov 13 16:00  hourly.2
   80% (50%)    0% ( 0%)  Nov 13 12:00  hourly.3
   83% (50%)    1% ( 0%)  Nov 13 08:00  hourly.4
   86% (50%)    1% ( 0%)  Nov 13 00:00  nightly.1
   87% (50%)    1% ( 0%)  Nov 12 20:00  hourly.5

  Volume marketing

    %/used       %/total  date          name
  ----------  ----------  ------------  --------
    0% ( 0%)    0% ( 0%)  Nov 14 08:00  hourly.0
   17% (16%)    0% ( 0%)  Nov 14 00:00  nightly.0
   28% (16%)    0% ( 0%)  Nov 13 20:00  hourly.1
   37% (16%)    0% ( 0%)  Nov 13 16:00  hourly.2
   44% (16%)    0% ( 0%)  Nov 13 12:00  hourly.3
   49% (16%)    1% ( 0%)  Nov 13 08:00  hourly.4
   54% (16%)    1% ( 0%)  Nov 13 00:00  nightly.1
   58% (16%)    1% ( 0%)  Nov 12 20:00  hourly.5

snap list -l [ vol_name ]
For each of the snapshots of a volume, this command displays the date the snapshot was taken along with the SnapLock retention date for the snapshot. A snapshot with a retention date may not be deleted until the retention date arrives. Higher precision date formats than typical are used so that one knows precisely when a snapshot may be deleted.

Snapshot retention dates may only be set for snapshots created via the snapvault command. The snapvault snap retain command can be used to extend an existing retention date further in the future.

The following is an example of the snap list command with the -l option on a volume named engineering.

  Volume engineering

  snapshot date               retention date              name
  --------------------------  --------------------------  --------
  Jun 30 21:49:08 2003 -0700  Jun 30 21:49:08 2013 -0700  nightly.0
  Jan 02 01:23:00 2004 -0700  Jan 02 01:23:00 2014 -0700  nightly.1
  Oct 12 18:00:00 2004 -0700  May 05 02:00:00 2010 -0700  nightly.2

snap list -b [ vol_name ]
If the -b option is specified, the owners of the busy snapshots are listed against the individual busy snapshots. If there are multiple owners referencing the same snapshot, all of them are listed.

snap list -q [ vol_name ]

snap list -o [ qtree_path ]
Displays the relationship between qtree replicas and the snapshots in which they were captured. Qtree replicas are created and maintained by Qtree SnapMirror and SnapVault.

If the -q option is specified, snapshots are listed for all volumes, or for only the specified volume if one is provided. For each snapshot, a list of qtrees captured by that snapshot is also displayed. The qtree list displays the name of each qtree, along with content type, a timestamp, and the replication source, if applicable.

The content type is one of Original, Replica, or Transitioning. The Original label indicates that the snapshot contains an original copy of the qtree, and not a replicated one. At the time the snapshot was created, the qtree was writable. The Replica label indicates that the snapshot contains a a consistent replica of some original source qtree, which is also listed on that line. The timestamp for a replica qtree is given as the date of the replication, not of the snapshot. The Transitioning label indicates that at the time the snapshot was taken, the replica qtree was in a transitional state, and therefore does not represent an exact copy of any original source qtree.

The following is an example of the snap list command with the -q option, on a filer named toaster with a volume named vault. The volume contains SnapVault qtree replicas from a volume named usr3 on a system named oven.

  toaster> snap list -q vault
  Volume vault
  working...

      qtree                 contents       date          source
      --------              -------------  ------------  --------
  sv_hourly.0  (Nov 18 18:56)
      dr4b                  Replica        Nov 18 18:55  oven:/vol/usr3/dr4b
      gf2e                  Replica        Nov 18 18:55  oven:/vol/usr3/gf2e
      mjs                   Replica        Nov 18 18:55  oven:/vol/usr3/mjs
      xydata                Original       Nov 18 18:56  -
  toaster(0007462703)_vault-base.0  (Nov 18 18:56)
      dr4b                  Replica        Nov 18 18:55  oven:/vol/usr3/dr4b
      gf2e                  Replica        Nov 18 18:55  oven:/vol/usr3/gf2e
      mjs                   Replica        Nov 18 18:55  oven:/vol/usr3/mjs
      xydata                Original       Nov 18 18:56  -
  hourly.0  (Nov 18 18:55)
      dr4b                  Transitioning  -             -
      gf2e                  Transitioning  -             -
      mjs                   Transitioning  -             -
      xydata                Original       Nov 18 18:55  -
  hourly.1  (Nov 18 18:52)
      dr4b                  Replica        Nov 18 18:50  oven:/vol/usr3/dr4b
      gf2e                  Replica        Nov 18 18:51  oven:/vol/usr3/gf2e
      mjs                   Replica        -             Unknown
  sv_nightly.0  (Nov 18 18:51)
      dr4b                  Replica        Nov 18 18:50  oven:/vol/usr3/dr4b
  sv_hourly.1  (Nov 18 18:49)

If the -o option is specified, then all qtrees are displayed, or only the specified qtree if one is provided. For each qtree displayed, a list of snapshots in which the qtree is not Transitioning is also given, along with the timestamp and replication source, if applicable.

The following is an example of the snap list command with the -o option, on a filer named toaster with a volume named vault. The volume contains SnapVault qtree replicas from a volume named usr3 on a system named oven.

  toaster> snap list -o /vol/vault/dr4b
  Qtree /vol/vault/dr4b
  working...

  date          source                name
  ------------  --------              --------
  Nov 18 18:55  oven:/vol/usr3/dr4b   sv_hourly.0
  Nov 18 18:55  oven:/vol/usr3/dr4b   toaster(0007462703)_vault-base.0
  Nov 18 18:50  oven:/vol/usr3/dr4b   hourly.1
  Nov 18 18:50  oven:/vol/usr3/dr4b   sv_nightly.0

On a vfiler, the snap list command only displays snapshots in volumes exclusively owned by the vfiler.

snap reclaimable volname snapshot-name ...

Displays the amount of space that would be reclaimed if the mentioned list of snapshots is deleted from the volume. The value returned is an approximate because any writes to the volume, or creation or deletion of snapshots will cause it to change.

This command may be long running and can be interrupted by Ctrl-C at any time during the execution.

snap rename vol_name old-snapshot-name new-snap_shot-name Gives an existing snapshot a new name. You can use the snap rename command to move a snapshot out of the way so that it won't be deleted automatically.

snap reserve [ vol_name | [ percent ] ] Sets the size of the indicated volume's snapshot reserve to percent. With no per_cent argument, prints the percentage of disk space that is reserved for snapshots in the indicated volume. With no argument, the snap reserve command prints the percentage of disk space reserved for snapshots for each of the volumes in the system. Reserve space can be used only by snapshots and not by the active file system.

snap restore [ -f ] [ -t vol | file ] [ -s snap_shot_name ]
[ -r restore_as_path ] vol_name restore_from_path

Reverts a volume to a specified snapshot, or reverts a single file to a revision from a specified snapshot.

The snap restore command is only available if your filer has the snaprestore license.

If you do not specify a snapshot, the filer prompts you for the snapshot.

Before reverting the volume or file, the user is requested to confirm the operation. The -f option suppresses this confirmation step.

If the -t option is specified, it must be followed by vol or file to indicate which type of snaprestore is to performed.

A volume cannot have both a volume snaprestore and a single-file snaprestore executing simultaneously. Multiple single-file snaprestores can be in progress simultaneously.

For volume snaprestore:

The volume must be online and must not be a mirror.

If reverting the root volume, the filer will be rebooted. Non-root volumes do not require a reboot.

When reverting a non-root volume, all ongoing access to the volume must be terminated, just as is done when a volume is brought offline. See the description under the vol offline command for a discussion of circumstances that would prevent access to the volume from being terminated and thus prevent the volume from being reverted.

After the reversion, the volume is in the same state as it was when the snapshot was taken.

For single-file snaprestore:

The volume used for restoring the file must be online and must not be a mirror.

If restore_as_path is specified, the path must be a full path to a filename, and must be in the same volume as the volume used for the restore.

Files other than normal files and LUNs are not restored. This includes directories (and their contents), and files with NT streams.

If there is not enough space in the volume, the single file snap restore will not start.

If the file already exists (in the active filesystem), it will be overwritten with the version in the snapshot.

It could take upto several minutes for before the snap command returns. During this time client exclusive oplocks are revoked and hard exclusive locks like the DOS compatibility lock are invalidated.

Once the snap command returns, the file restore will proceed in the background. During this time, any operation which tries to change the file will be suspended until the restore is done. Also, other single-file snap restores can be executed.

Also it is possible for the single file snap restore to be aborted if we run out of disk space during the operation. When this happens the timestamp of the file being restored will be updated. Thus it will not be the same as the timestamp of the file in the snapshot.

An in-progress restore can be aborted by removing the file. For NFS users, the last link to the file must be removed.

The snapshot used for the restore cannot be deleted. New snapshots cannot be created while a singlefile snaprestore is in progress. Scheduled snapshots on the volume will be suspended for the duration of the restore.

Tree, user and group quota limits are not enforced for the owner, group and tree in which the file is being restored. Thus if the user, group or tree quotas are exceeded, /etc/quotas will need to be altered after the single file snap restore operation has completed. Then quota resize will need to be run.

When the restore completes, the file's attributes (size, permissions, ownership, etc.) should be identical as those in the snapshot.

If the system is halted or crashes while a single file snap restore is in progress then the operation will be restarted on reboot.

snap sched [ vol_name [ weeks [ days [ hours [ @list ] ] ] ] ]
Sets the schedule for automatic snapshot creation. The argument vol_name identifies the volume the schedule should be applied to. The second argument indicates how many weekly snapshots should be kept on-line, the third how many daily, and the fourth how many hourly. If an argument is left off, or set to zero, then no snapshot of the corresponding type is created. Daily snapshots are created at 24:00 of each day except Sunday, and weekly snapshots are created at 24:00 on Sunday. Only one snapshot is created at a time. If a weekly snapshot is being created, for instance, no daily or hourly snapshot will be created even if one would otherwise be scheduled. For example, the command

snap sched vol0 2 6

indicates that two weekly snapshots and six daily snapshots of volume vol0 should be kept on line. No hourly snapshots will be created. For snapshots created on the hour, an optional list of times can be included, indicating the hours on which snapshots should occur. For example the command

snap sched vol0 2 6 [email protected],12,16,20

indicates that in addition to the weekly and daily snapshots, eight hourly snapshots should be kept on line, and that they should be created at 8 am, 12 am, 4 pm, and 8 pm. Hours must be specified in 24-hour notation.

With no argument, snap sched prints the current snapshot schedule for all volumes in the system. With just the vol_name argument, it prints the schedule for the specified volume.

SEE ALSO

na_df(1)

BUGS

The time required by the snap list command depends on the size of the file system. It can take several minutes on very large file systems. Use snap list -n instead.


Table of Contents