Mark - thank you very much for your explanation and example. I really
appreciate. Any ranting below is directed at ZFS, not you. =)

> > Snapshot Used Total (GB) == 766.73
> > Filesystem Referenced Total (GB) == 2570.04 Total of Snap Used + FS 
> > Ref (GB) == 3336.76
> >
> > Vol0 filesystem Used (GB) == 5159.35
> 
> The sums don't really work that way.

I followed your recipe, except using a 70MB tarfile instead of a 1GB
file:

> Consider this scenario:
> - I create a dataset and copy 1g into it

titan[root]:/> zfs create vol0/testfs

titan[root]:/> zfs list vol0/testfs
NAME          USED  AVAIL  REFER  MOUNTPOINT
vol0/testfs  52.3K  1.58T  52.3K  /vol0/testfs

titan[root]:/> cd /vol0/testfs
titan[root]:/vol0/testfs> tar cvf test.tar /groups/eng_staff

titan[root]:/vol0/testfs> zfs list vol0/testfs
NAME          USED  AVAIL  REFER  MOUNTPOINT
vol0/testfs  72.4M  1.58T  72.4M  /vol0/testfs

> - I take a snapshot of it, @snap1

titan[root]:/vol0/testfs> zfs snapshot vol0/[EMAIL PROTECTED]

titan[root]:/vol0/testfs> zfs list -r vol0/testfs
NAME                USED  AVAIL  REFER  MOUNTPOINT
vol0/testfs        72.4M  1.58T  72.4M  /vol0/testfs
vol0/[EMAIL PROTECTED]      0      -  72.4M  -

> - I copy 1g more data into the datset

titan[root]:/vol0/testfs> tar cvf test2.tar /groups/eng_staff

titan[root]:/vol0/testfs> zfs list -r vol0/testfs
NAME                USED  AVAIL  REFER  MOUNTPOINT
vol0/testfs         145M  1.58T   145M  /vol0/testfs
vol0/[EMAIL PROTECTED]  48.0K      -  72.4M  -

titan[root]:/vol0/testfs> du -sh .
 145M   .

> - I take another snapshot, @snap2

titan[root]:/vol0/testfs> zfs snapshot vol0/[EMAIL PROTECTED]

titan[root]:/vol0/testfs> zfs list -r vol0/testfs
NAME                USED  AVAIL  REFER  MOUNTPOINT
vol0/testfs         145M  1.58T   145M  /vol0/testfs
vol0/[EMAIL PROTECTED]  48.0K      -  72.4M  -
vol0/[EMAIL PROTECTED]      0      -   145M  -

> - I delete the two 1g files.

titan[root]:/vol0/testfs> rm test.tar test2.tar
titan[root]:/vol0/testfs> zfs list -r vol0/testfs
NAME                USED  AVAIL  REFER  MOUNTPOINT
vol0/testfs         145M  1.58T   145M  /vol0/testfs
vol0/[EMAIL PROTECTED]  48.0K      -  72.4M  -
vol0/[EMAIL PROTECTED]      0      -   145M  -

After a minute:

titan[root]:/vol0/testfs> zfs list -r vol0/testfs
NAME                USED  AVAIL  REFER  MOUNTPOINT
vol0/testfs         145M  1.58T  52.3K  /vol0/testfs
vol0/[EMAIL PROTECTED]  48.0K      -  72.4M  -
vol0/[EMAIL PROTECTED]  72.4M      -   145M  -

 
> What's left on the system?  The first file is available via 
> both the snapshots, and the second file will be available via 
> the second snapshot only.  In other words, @snap1 will have a 
> 'refer' value of 1g, and @snap2 will have a 'refer' value of 
> 2g.  The dataset itself will only 'refer' to the overhead, 
> but will have a 'used' value of 2g.

And you're completely correct!

> However, the 'used' values of @snap1 and @snap2 will only 
> contain the deltas for the snapshots.  @snap1 will contain 
> just the filesystem metadata for the 'used' - around 16-20k, 
> and @snap2 will contain the metadata plus the second 1g file.
> 
> So, crunching the numbers using the method outlined above, 
> the snapshot used total is approx 1g, and the filesystem 
> refer total is 16-20k.  These don't add up to the amount of 
> data still being consumed by the pool (the two 1g files), 
> because used & refer are tracking different pieces of information.

Right, so I follow everything you have said here... but I guess I'm
still at a loss.

I think based on this, there really isn't a good way to know how much
space is being consumed by snapshots? 

The only way I can think of based on this is to use "zfs list" or "zfs
get" to get the "referenced" numbers, ONLY for filesystems (annoyingly,
"zfs get" doesn't seem to have a -t flag). Then I have to add up all of
the referenced numbers.

Only THEN can I subtract that number from the "used" number for the
entire volume to find out how much is being consumed by snapshots.

Is there any other way?

Then back to the issue at hand... which was the point of this whole
exercise:

How do I figure out how much disk space is being used by a given
snapshot, or group of snapshots?

This all of a sudden feels like a huge limitation of ZFS. I'm already
dealing with the annoyance of not having quotas... now I feel more at
sea without a rudder given that I can't even tell what disk space is
being used by my snapshots!

thanks

johnS
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to