Snapshot commands and options

Snapshot commands

The commands related to snapshots are listed in the following table. If the volume name is omitted in any of these commands, the command applies to the root volume.

Command Meaning
snap list1 volume_name Lists all available snapshots.
snap create volume_name snapshot_name Creates a snapshot with a specified name.
snap delete volume_name snapshot_name Deletes a specified snapshot.
snap rename volume_name from to Renames a snapshot.
snap reserve volume_name Reserves a percentage of the disk space for snapshots.
snap sched volume_name Schedules automatic snapshots.

Snapshot options

The following options for the vol options command affect snapshots in the specified volume. The options remain in effect after the filer reboots.

Options Descriptions
nosnap Disables automatic snapshots. By default, this option is disabled.
nosnapdir Makes the .snapshot directory that is present at client mount points or the root of the CIFS share invisible. It also turns off access to the .snapshot directory and all .snapshot directories under the mount point or the root of the CIFS share. By default, this option is disabled.

Note: The dump command does not work if the nosnapdir or nosnap option is on.


Automatic snapshot creation

The filer uses the snap sched command to create snapshots automatically and to keep them on-line for a predetermined amount of time.

Types of automatic snapshots

The following table describes the three types of automatic snapshots.

Type Description
Weekly The filer creates these every Sunday at midnight. Weekly snapshots are called weekly.n, where n is an integer. weekly.0 is the most recent weekly snapshot, and weekly.1 is the next most recent weekly snapshot. When the filer creates a weekly snapshot, the value of n is adjusted for all weekly snapshots. The higher the value of n, the older the snapshot.
Nightly The filer creates these every midnight except when a weekly snapshot is scheduled to occur at the same time. If the number of weekly snapshots is nonzero and it's the day of the week that weekly snapshots occur, no nightly snapshot is created. Nightly snapshots are called nightly.n, where n is an integer. nightly.0 is the most recent nightly snapshot, and nightly.1 is the next most recent nightly snapshot. When the filer creates a nightly snapshot, the value of n is adjusted for all nightly snapshots. The higher the value of n, the older the snapshot.
Hourly The filer creates these on the hour at specified hours, except at midnight, if a nightly or weekly snapshot is scheduled to occur at the same time. This occurs either if the number of nightly snapshots in the schedule is nonzero, or if the number of weekly snapshots in the schedule is nonzero and it's the day of the week that weekly snapshots occur. Hourly snapshots are called hourly.n, where n is an integer. hourly.0 is the most recent hourly snapshot, and hourly.1 is the next most recent hourly snapshot. When the filer creates an hourly snapshot, the value of n is adjusted for all hourly snapshots. The higher the value of n, the older the snapshot.

Example 1 of snap sched command

The following example shows a sample snap sched command:

In the snap sched command, the first argument after the volume name in the example indicates how many weekly snapshots to keep (2), the second argument indicates how many nightly snapshots to keep (6), and the third argument indicates how many hourly snapshots to keep (8). A zero in any of the three positions disables snapshots for that interval.

The argument for hourly snapshots can include an optional list of numbers indicating the hours at which the filer creates the snapshots in 24-hour time (8, 12, 17, 20). If the argument is omitted, the filer creates an hourly snapshot.

The default snapshot schedule is

snap sched volume_name 0 2 6@8,12,16,20

Example 2 of snap sched command

Following is an example of the snap sched command:

snap sched volume_name 2 6 8@8,12,16,20 
Snapshots created by this schedule

The following list describes the snapshots created by the example:

The following list shows the snapshots that are created by this snapshot schedule in 1998 (when January 11 is a Sunday):

% ls -lu .snapshot 
total 64
drwxrwsrwx  2 root 4096 Jan 14 12:00 hourly.0
drwxrwsrwx  2 root 4096 Jan 14 08:00 hourly.1
drwxrwsrwx  2 root 4096 Jan 13 20:00 hourly.2
drwxrwsrwx  2 root 4096 Jan 13 16:00 hourly.3
drwxrwsrwx  2 root 4096 Jan 13 12:00 hourly.4
drwxrwsrwx  2 root 4096 Jan 13 08:00 hourly.5
drwxrwsrwx  2 root 4096 Jan 12 20:00 hourly.6
drwxrwsrwx  2 root 4096 Jan 12 16:00 hourly.7
drwxrwsrwx  2 root 4096 Jan 14 00:00 nightly.0
drwxrwsrwx  2 root 4096 Jan 13 00:00 nightly.1
drwxrwsrwx  2 root 4096 Jan 12 00:00 nightly.2
drwxrwsrwx  2 root 4096 Jan 10 00:00 nightly.3
drwxrwsrwx  2 root 4096 Jan 09 00:00 nightly.4
drwxrwsrwx  2 root 4096 Jan 08 00:00 nightly.5
drwxrwsrwx  2 root 4096 Jan 11 00:00 weekly.0
drwxrwsrwx  2 root 4096 Jan 04 00:00 weekly.1 
Result

This schedule keeps the eight most recent hourly snapshots, created at 8 a.m., noon, 4 p.m., and 8 p.m. every day, the six most recent daily snapshots, and the two most recent weekly snapshots. Whenever the filer creates a new snapshot of a particular type, it deletes the oldest one and renames the existing ones. On the hour, for example, the filer deletes hourly.7, renames hourly.0 to hourly.1, and so on. The nightly snapshot schedule jumps from January 12 to January 10 because there is a weekly snapshot on January 11.


Note: On a UNIX client, if you use ls -l instead of ls -lu to list the snapshot creation times, the times are not necessarily all different. The times listed by ls -l reflect the modification times of the directory at the time of each snapshot, and are not related to the times at which the snapshots are created.


The snap sched command is persistent across reboots. There is no need to put the command in the /etc/rc file.

User-defined automatic snapshots

You can create snapshots at predefined times instead of using the hourly, daily, and weekly schedules.

Example

For example, if you want to create two snapshots for the volume named vol1 each week, you can set up a cron job on the administration host to run twice each week at an appropriate time to execute the following snap create command:

rsh toaster snap create vol1 filename

Note: The snap create command does not accept a snapshot name containing a slash (/).



Copyright © 1998, Network Appliance, Inc. All rights reserved.

snap2.htm Last updated: 09/25/98 14:22:36