Tuesday, March 30, 2010

ZFS: Snapshot Differences

ZFS: Snapshot Differences


ZFS, the first modern Open Source file system, was released years ago. The Copy on Write (CoW) capability of the file system offers distinct capabilities, such as inherent capability to understand the state of the file system over time. The ability to provide nearly unlimited snapshots to the file system is an example of the features capable with CoW. The ability to offer the user differences between snapshots was recently introduced into OpenSolaris.


Recently introduced into OpenSolaris, PSARC/2010/105 provides the ability "to describe what has changed between the snapshots of a dataset" based upon ZFS.

The syntax looks similar to the following:
zfs diff [snapshot] [snapshot|filesystem]
The output describes the changes noted between the ZFS datasets.
The type of change is described with a single character:
+ Indicates the file/directory was added in the later dataset
- Indicates the file/directory was removed in the later dataset
M Indicates the file/directory was modified in the later dataset
R Indicates the file/directory was renamed in the later dataset

If the modification involved a change in the link count of a
file, the change will be expressed as a delta within
parentheses on the modification line. Example outputs are

M /myfiles/
M /myfiles/link_to_me (+1)
R /myfiles/rename_me -> /myfiles/renamed
- /myfiles/delete_me
+ /myfiles/new_file


An example of usage is as follows:
# echo 'tim was here' > file
# zfs snapshot toad/timh@before
# touch file
# zfs snapshot toad/timh@after
# zfs diff toad/timh@before toad/timh@after
M /toad/timh/file
Benefits to Network Management:

The benefits to adding such capabilities to Solaris include:
  • Multiple revisions of code can be tracked through a regularly scheduled cron to snapshot the ZFS file system, today.
  • Developers, with minimal work, can roll back to old code, when applying snapshots to filesystes on a regular basis, today.
  • The addition of the "diff" gives developers the ability to understand the other dependencies, if multiple changes happened to multiple files at the same time.
  • Capabilities are provided in a transparent way where no additional time must be consumed by developers, making the more efficient, driving a fiscal reason to move to ZFS under Solaris.
  • If a production environment starts experiencing problems, the snapshot diff can be used to find out what seemingly unrelated changes could have affected the production environment, driving an availability reason to move to ZFS under Solaris.
  • This is a simple way to audit production systems, guaranteeing the integrity of production platforms against virus infestation, driving legal reasons to move to ZFS under Solaris.
  • Virus scanning of media can be significantly quickened if seeding the scanner with the diff between snapshots, reducing overall load on disk subsystems as well as CPU capacity, extending the life of existing infrastructure while meeting existing security requirements.
  • Snapshots can be taken while applications are in "hot backup" mode, or during a nightly restart of an application. Differences can be backed up using the diff, instead of the less efficient checking every file handle for changes, allowing for more efficient backups to be done against an application in production, better meeting business continuity requirements.
There are numerous benefits to ZFS Snapshot differences that can change the way businesses do computing today - if the businesses decide to leverage them to meet their development, fiscal, legal, security requirements, and business continuity requirements.

No comments:

Post a Comment