Skip to main content
NetApp Knowledge Base

How does the Snapshot reserve work?

Views:
4,654
Visibility:
Public
Votes:
5
Category:
data-ontap-7
Specialty:
7dot
Last Updated:

Applies to

Data ONTAP 8 7-mode

Answer

How does the Snapshot reserve work?
Disk consumption by multiple identical snapshots

Example: A snapshot contains a 1-MegaBytes (MB) file that hasn't changed since the filer created the snapshot. If that file is removed from the active file system, then the snapshot then consumes 1 MB of disk space.

The same version of that 1-MB file may be referenced by several different snapshots: hourly.0, hourly.1, and hourly.2. If these snapshots all contain the 1-MB file that hasn't changed since the filer created those snapshots, only 1 MB of disk space is consumed by the snapshots even though all three snapshots contain the file.

How does df command display snapshots

To provide information about the snapshot disk utilization,  df command on the filer treat snapshots as a partition different from the active file system. The following is an example of a df command:

toaster> df
Filesystem kbytes used avail capacity
/ 3000000 2000000 1000000 65%
/.snapshot 1000000 500000 500000 50%

Note: The numbers in this example have been rounded off to make the example easier to understand.

The filer has 4 GigaByte (GB) of disk space with 1 GB (or 25%) reserved for snapshots (the idea of reserving space for snapshots is described in more detail later). That leaves 3 GB for the active file system, and 2 GB of the file system is in use. It is important to understand that the /.snapshot line counts data that exists only in a snapshot. Because data that also exists in the active file system needs to be stored on disk anyway, it would be misleading if the filer charged the space to snapshots. In the example, half of the 1 GB reserved for the snapshot is actually used.

How does the snapshot reserve work

Given the way snapshots consume disk space, why reserve space for them? Why not just let them use whatever space they need? To understand the answer, consider what would happen if the filer created a snapshot when the disks were full. Removing files from the active file system wouldn't create any free space, because everything in the active file system would also be referenced by the newly created snapshot. The filer would have to delete the snapshot before it could create any new files.

By default, the snapshot reserve is 20% of disk space. For information about how to adjust the amount of the snapshot reserve, refer to Changing the Snapshot Reserve.

Consider what happens if the filer creates a snapshot when the active file system is full and there is still space remaining in the snapshot reserve. The df output might show:

Filesystem kbytes used avail capacity
/ 3000000 3000000 0 100%
/.snapshot 1000000 500000 500000 50%

If you remove 100 MB of files, the data belonging to these files will no longer be part of the active file system, so the space will be charged to the snapshots instead. The new df output is as follows:

Filesystem kbytes used avail capacity
/ 3000000 2900000 100000 97%
/.snapshot 1000000 600000 400000 60%

Note that the filer reassigns 100 MB of space from the active file system to the snapshot reserve. Because there was reserve space for snapshots, removing files from the active file system freed up space for new files.

Even with the snapshot reserve, the job of administering snapshot disk space consumption is important. There is no way to prevent snapshots from consuming disk space greater than the amount reserved for them. Consider what would happen in our example file system if all files in the active file system were deleted. Before the deletion, the df output was:

Filesystem kbytes used avail capacity
/ 3000000 3000000 0 100%
/.snapshot 1000000 500000 500000 50%

After removing all of the data in the file system, the df command generates the following:

Filesystem kbytes used avail capacity
/ 3000000 2500000 500000 83%
/.snapshot 1000000 3500000 0 350%

The entire 3 GB in the active file system moved into snapshots, along with the 500 MB that were in snapshots before, making a total of 3.5 GB of snapshot data. This is 2.5 GB more than the space reserved for snapshots. Because the active file system cannot use that space, the space shows up as used by the active file system even though no files are actually there.

Whenever snapshots consume more than 100% of the snapshot reserve, the system is in danger of becoming full. In this case, you can create files only after you remove enough snapshots. For instance, if 500 MB of data were added to the active file system in the example above, a df command would generate the following information:

Filesystem kbytes used avail capacity
/ 3000000 3000000 0 100%
/.snapshot 1000000 3500000 0 350%

As soon as the filer creates a new snapshot, every block in the system will be referenced by some snapshot, so no matter how many files you remove from the active file system, there will still not be room to add any more. The only way to recover from this situation is to remove enough snapshots to free more disk space. Refer to Displaying Snapshot Statistics for information about how to use the snap list command to determine which snapshot to delete.

Disk consumption by multiple identical snapshots

Additional Information

N/A

 

NetApp provides no representations or warranties regarding the accuracy or reliability or serviceability of any information or recommendations provided in this publication or with respect to any results that may be obtained by the use of the information or observance of any recommendations provided herein. The information in this document is distributed AS IS and the use of this information or the implementation of any recommendations or techniques herein is a customer's responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. This document and the information contained herein may be used solely in connection with the NetApp products discussed in this document.