On Thu, Aug 20, 2009 at 5:25 PM, Robert Milkowski <mi...@task.gda.pl> wrote:

>  Matthew Stevenson wrote:
>
> Ha ha, I know! Like I say, I do get COW principles!
>
> I guess what I'm after is for someone to look at my specific example (in txt 
> file attached to first post) and tell me specifically how to find out where 
> the 13.8GB number is coming from.
>
> I feel like a total numpty for going on about this, I really do, but despite 
> all the input I still don't see an answer to this basic question.
>
> I promise this will be my last post querying the subject!
>
>
>
>  The problem is how do you account for data which is referenced by more
> than one snapshot? Which snapshot would you "charge" then? The used property
> only tells you how much *unique* data is being held by snapshot (so the data
> is not referenced by any other snapshot or filesystem). If some data is
> referenced by more than one snapshot it is accounted as used for a file
> system for lack of better way of presenting it to user. The usedbysnap
> property represents the amount of storage to be regained if all snapshots
> were removed.
>
> Lets say you created 1GB file: /pool/file1.
> Now you created snapshot: zfs snapshot p...@snap1
>
> so far the snapshot does not consume any data.
>
> now create another 1GB file: /pool/file2
> and create another snapshot: zfs snapshot p...@snap2
>
> Notice that file1 is referenced by both snapshots while file2 is referenced
> only by snap2.
>
> Now remove file1 from the filesystem. Because both snapshots reference it
> against which one should you report 1GB of usage? In such a case the 1GB
> will be charged against main filesystem only. If you remove file2 used space
> will be charged against filesystem and snap2 as it is only snap2 which
> references to it so there is no confusion as what it should be charged
> against.
>
> Example:
>
>
> mi...@r600:~# zfs create rpool/test
> mi...@r600:~# mkfile 10m /rpool/test/file1
> mi...@r600:~# zfs snapshot rpool/t...@snap1
> mi...@r600:~# mkfile 10m /rpool/test/file2
> mi...@r600:~# zfs snapshot rpool/t...@snap2
>
> mi...@r600:~# zfs list -r -t all rpool/test
> NAME               USED  AVAIL  REFER  MOUNTPOINT
> rpool/test        20.0M  93.0G  20.0M  /rpool/test
> rpool/t...@snap1    17K      -  10.0M  -
> rpool/t...@snap2      0      -  20.0M  -
>
> mi...@r600:~# rm /rpool/test/file1
>
> mi...@r600:~# zfs list -r -t all rpool/test
> NAME               USED  AVAIL  REFER  MOUNTPOINT
> rpool/test        *20.1M * 93.0G  *10.0M * /rpool/test
> rpool/t...@snap1    17K      -  10.0M  -
> rpool/t...@snap2    17K      -  20.0M  -
> mi...@r600:~#
>
> mi...@r600:~# rm /rpool/test/file2
>
> mi...@r600:~# zfs list -r -t all rpool/test
> NAME               USED  AVAIL  REFER  MOUNTPOINT
> rpool/test        20.1M  93.0G    19K  /rpool/test
> rpool/t...@snap1    17K      -  10.0M  -
> rpool/t...@snap2  10.0M      -  20.0M  -
> mi...@r600:~#
>
> Since file2 is referenced uniquely only by snap2 it is reported as used
> space of snap2.
> file1 is referenced by both snapshots so its 10MB is charged against
> filesystem only as it is not clear which snapshot should heave represent it.
>
> Usedbysnashot should point to ~20MB:
>
> mi...@r600:~# zfs get usedbysnapshots rpool/test
> NAME        PROPERTY         VALUE     SOURCE
> rpool/test  usedbysnapshots  20.0M     -
> mi...@r600:~#
>
>
>
>
> So going back to your case (I haven't read you attachment but I think I got
> it right): all your snapshots are using 13.8GB as that much data is being
> referenced by them but no longer by filesystem (so data was modified or
> deleted from the filesystem). Now some of that data is referenced by
> multiple snapshots so it is not clear against which one it should be
> reported. Some of data is being uniquely referenced by only a one snapshot
> so such data is easy to be represented as being used by that specific
> snapshot.
>
>
> I hope it is clear now...
>
> --
> Robert Milkowski
> http://milek.blogspot.com
> -
>


Kudos: Very nicely written Robert!  :)
Perhaps we can add this to the ZFS FAQs

Regards,

Al Hopper  Logical Approach Inc,Plano,TX a...@logical-approach.com
                  Voice: 972.379.2133 Timezone: US CDT
OpenSolaris Governing Board (OGB) Member - Apr 2005 to Mar 2007
http://www.opensolaris.org/os/community/ogb/ogb_2005-2007/
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to