Managing snapshot disk consumption

About snapshot management

This section describes

The examples in this section are for a volume named home.

Scheduling snapshots

The best way to manage the amount of space consumed by snapshots in each volume is to use the snap sched command to adjust the schedule of snapshot creation.

Following are some suggested strategies for scheduling and retaining snapshots:

snap sched home 0 2 6@8,12,16,20 
snap sched home 2 6 8@8,12,16,20 
snap sched home 0 0 3 

This schedule doesn't consume much disk space, and it lets users recover files in recent snapshots as long as they notice their mistake within a couple of hours.

Displaying snapshot statistics

The snap list command shows the amount of disk space used by snapshots in a specified volume. This command enables you to see how much disk space each snapshot uses, and helps you determine an appropriate snapshot reserve.

Command output

Following is an example of the command output. If you don't specify a volume name in the command, the output contains statistics about each volume.

snap list vol0
Volume vol0
%/used       %/total    date          name
----------  ----------  ------------  --------
0% ( 0%)    0% ( 0%)    Jan 19 08:01  hourly.0
1% ( 1%)    1% ( 1%)    Jan 19 00:01  nightly.0
2% ( 2%)    2% ( 2%)    Jan 18 20:01  hourly.1
3% ( 2%)    2% ( 2%)    Jan 18 16:01  hourly.2
3% ( 2%)    3% ( 2%)    Jan 18 12:01  hourly.3
5% ( 3%)    4% ( 3%)    Jan 18 00:01  nightly.1
7% ( 4%)    6% ( 4%)    Jan 17 00:00  nightly.2
8% ( 4%)    7% ( 4%)    Jan 16 00:01  nightly.3
10%( 5%)    9% ( 4%)    Jan 15 00:01  nightly.4
The %/used column

The %/used column shows space consumed by snapshots as a percentage of disk space being used in the volume. The first number is cumulative for all snapshots listed so far, and the second number is for the specified snapshot alone.

The %/total column

The %/total column shows space consumed as a percentage of total disk space in the volume.

"Cumulative snapshot space" is the total space used by this snapshot and all other more recent snapshots (the ones preceding this snapshot in the snap list output).

Output summary

The %/used number is more useful for planning the snapshot reserve because it is more likely to remain constant as the file system fills.

The example shows a volume that keeps five nightly snapshots and four hourly snapshots. That is, the volume uses the following command for creating snapshots regularly:

snap sched vol0 0 5 4@8,12,16,20

The snap list output shows that the overhead for snapshots is only 10%, so the default snapshot reserve of 20% seems to be a waste of disk space. Assuming that this pattern of change holds up, a reserve of 12% to 15% provides a safe margin to ensure that removing files frees disk space when the active file system is full.

The values in parentheses, that is, the values that show the space used by an individual snapshot, are useful in identifying a particular snapshot to remove when the file system is full. However, deleting a particular snapshot doesn't necessarily release the total amount of disk space indicated, because other snapshots might be referring to the same blocks. Refer to "Adjusting disk space used by snapshots" for further information about how to select a snapshot file for deletion to reclaim disk space.

If you do not want the total amount of disk space consumed by all snapshots to exceed a certain percentage of the used disk space, use the cumulative values in the snap list output to determine which snapshots to delete. In the preceding example, if you don't want more than 5% of used disk space to be spent by snapshots, delete all snapshots listed below nightly.1 in the snap list output; that is, nightly.2, nightly.3, and nightly.4. After deleting the snapshots, nightly.1 and all the other more recent snapshots consume 5% of the used disk space.

Changing the snapshot reserve

The snapshot reserve can be used only by snapshots, not by the active file system.

The default snapshot reserve is 20% of the available disk space. To change the reserve, enter the following command:

snap reserve volume_name percent

For example:

snap reserve vol0 25

With no arguments, the snap reserve command displays the percentage of disk space reserved for snapshots in each volume.


Note: Snapshots can exceed the snapshot reserve space.


Adjusting disk space used by snapshots

This section describes how to use the snap list output to determine which snapshot file to delete to free the most disk space.

In the sample snap list output in "Displaying snapshot statistics", the cumulative disk space used by snapshots gradually increases from top to bottom.

For example, in the %/used column, the cumulative space used by hourly.1 is 2% and the cumulative space used by hourly.2 is 3%. This is not always the case.

Example

Consider a filer with a 100-MB file system that has not changed since the first snapshot was taken. The snap list command on this filer displays the following output:

%/used      %/total     date          name
--------    ---------   ------------  ---------
0% (0%)     0% (0%)     May 05 16:00  hourly.0
0% (0%)     0% (0%)     May 05 12:00  hourly.1
0% (0%)     0% (0%)     May 05 08:00  hourly.2

The cumulative disk space used by snapshots does not increase because no changes were made to the file system. However, if you had deleted 20 MB from the file system before the filer took the hourly.0 snapshot, the snap list command would have displayed the following output:

%/used       %/total      date          name
--------     ---------    ------------  ---------
0%  (0%)      0% (0%)     May 05 16:00  hourly.0
20% (20%)     1% (1%)     May 05 12:00  hourly.1
20% (20%)     1% (1%)     May 05 08:00  hourly.2

In the %/used column, the cumulative values for hourly.1 and hourly.2 are both 20%, but the cumulative value for hourly.2 is not 40%. This is because both snapshots point to the same 20 MB of data, the data that you just deleted.

The cumulative values for hourly.1 and hourly.2 are different if you delete and create data between snapshots in the following way:

  1. Delete 20 MB of data and create 20 MB of new data after hourly.2.
  2. Delete the 20 MB of data created in Step 1 after hourly.1.

After the data deletions and additions, the snap list command displays the following output:

%/used       %/total      date          name
--------     ---------    ------------  ---------
0%  (0%)      0% (0%)     May 05 16:00  hourly.0
20% (20%)     1% (1%)     May 05 12:00  hourly.1
33% (20%)     2% (1%)     May 05 08:00  hourly.2

In this scenario, hourly.1 and hourly.2 each consume 20% of the used disk space: 20 MB out of 100 MB. However, this time they reference different data blocks. Cumulatively, they consume 40 MB, which is about 33% of the disk space used: 120 MB, which is 40 MB used by snapshots plus 80 MB in the file system.

Before trying to conserve space by deleting a large snapshot file, examine the cumulative values in the snap list output. If two adjacent snapshot files show little difference in the cumulative values, most of the data referenced by the snapshots is the same. In this case, removing one of the snapshots doesn't free much disk space.

If you find snapshots confusing and hard to manage, use the default snapshot schedule and the default snapshot reserve because these settings are appropriate for most environments. When you create a new volume on a filer, remember that the new volume inherits the snapshot schedule from the root volume. After you use the volume for a while, check how much disk space the snapshots consume in the volume. If the disk space seems high, decrease the amount of time that snapshots are kept or increase the snapshot reserve.

As you use snapshots, continue to watch the statistics change over time. The statistics help you gain a better understanding of how snapshots work.


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

Part No. 210-02334
File: snap4.htm
Last updated: 02/24/99 12:16:53