Monday, March 29, 2010

ZFS diff


PSARC/2010/105
:

There is a long-standing RFE for zfs to be able to describe
what has changed between the snapshots of a dataset.
To provide this capability, we propose a new 'zfs diff'
sub-command. When run with appropriate privilege the
sub-command describes what file system level changes have
occurred between the requested snapshots. A diff between the
current version of the file system and one of its snapshots is
also supported.

Five types of change are described:

o File/Directory modified
o File/Directory present in older snapshot but not newer
o File/Directory present in newer snapshot but not older
o File/Directory renamed
o File link count changed

      zfs diff snapshot  snapshot | filesystem

Gives a high level description of the differences between a
snapshot and a descendant dataset. The descendant may either
be a later snapshot of the dataset or the current dataset.
For each file system object that has undergone a change
between the original snapshot and the descendant, the type of
change is described along with the name of the file or
directory. In the case of a rename, both the old and new
names are shown.

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
below:

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

5 comments:

  1. I think it probably will make it into b138-b140. Depending on the ARC case outcome it might even take more time to be integrated.

    ReplyDelete
  2. Hi Milek
    Thanks for your wonderful blog. I'm struggling to get a script, which is to generate the User home directory usage in a NFS server, which is mounted on different NAS servers, in NIS
    can you give me some input,where can i find some sample script...
    Thanks a lot
    best regards
    VJ

    ReplyDelete
  3. It'd be useful to get something like json as output instead of plain text.

    ReplyDelete