Understanding snapshots

What is a snapshot?

A snapshot is a read-only copy of the entire file system--it reflects the state of the file system at the time the snapshot was created.

Accessing snapshots

Any client of a filer can access snapshots to recover old versions of files; for example, files that were accidentally changed or deleted. The snapshot feature enables users to restore their own files without help, because files in snapshots can be viewed and copied by those who have permission to do so with the original files.

Simplifying tape backup

Snapshots also simplify tape backup. The filer dump command automatically creates a snapshot of the active file system, if necessary, before backing up the data to tape. However, it is not necessary if you are backing up an existing snapshot. Because a snapshot is a read-only copy of the file system, it does not change even when files in the active file system are changing. As a result, dump can make a safe and consistent backup without requiring you to take the filer off-line.

Snapshots use little disk space

The filer uses a copy-on-write technique to create snapshots quickly without consuming any disk space. Snapshots begin to consume extra space only as blocks in the active file system are modified and written to new locations on disk. For more information about the copy-on-write technique used by snapshots, refer to "How snapshots work."

Creating snapshots for your needs

The filer creates and deletes snapshots automatically at preset intervals. You can also create and delete snapshots manually. Each volume on the filer can have up to 20 different snapshots at one time.

Snapshots maintain original file permissions

Snapshot files carry the same permissions and inode numbers as the original files, keeping the integrity of the security system intact. Inodes are data structures that hold information about files on the filer. There is an inode for each file and a file is uniquely identified by the file system on which it resides and its inode number on that system.


Note: The inode number for a file in a snapshot is the same as the inode number for the corresponding file in the active file system. As a result, some programs on UNIX clients consider the two files to be the same. For example, if you use the GNU diff program to compare the two files, it does not find any differences between them. To make sure that the two files have different inode numbers before the comparison, copy one of the files to another name.


How snapshots work

When the filer creates a snapshot, it doesn't copy disk blocks; instead, it identifies all blocks in the file system as belonging to the snapshot as well as to the active file system.

Example

Consider a particular file named foo in a newly created snapshot. Because the snapshot was just created, the snapshot version of foo has the same contents as the version in the active file system. The same blocks on disk store both versions, so the snapshot version of foo consumes no disk space.

Later, if foo is deleted, the blocks holding the data for foo are no longer part of the active file system, but they are still part of the snapshot. Therefore, deleting foo from the active file system does not free any disk space.

Diagram of a snapshot

The following figure illustrates how disk space is used before and after foo is removed.

Changing the contents of foo creates a similar situation. New data written to foo cannot be stored in the same disk blocks as the current contents because the snapshot is using those blocks to store the old version of foo. Instead, the new data is written to new disk blocks, so there are two separate copies of foo on disk--a new copy in the active file system and an old one in the snapshot. This technique of duplicating disk blocks only as they are modified is called copy-on-write.

In some directories, most data remains unchanged from day to day. For example, a user with a 10-MB home directory might change only 100 KB to 500 KB on a typical day. When files change slowly, snapshots can be kept on-line for days or even weeks before they begin to consume unacceptable amounts of disk space. In other directories, data changes quickly. If a large percentage of data changes every day, there might not be room to keep snapshots for even a few hours. To accommodate the needs of different users, create multiple volumes on the filer. In this way, you can apply different snapshot schedules to different volumes.

In summary, when the filer creates a snapshot, it doesn't use any disk space, but as files in the active file system are changed or deleted, the snapshot uses more and more disk space. How often files are changed and deleted determines the number of snapshots the filer can create and the length of time the snapshots can be kept.


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

Part No. 210-02334
File: snap1.htm
Last updated: 04/26/99 08:11:44