All,
I assume this issue is pretty old given the time ZFS has been around. I have
tried searching the list but could not get understand the structure of how
ZFS actually takes snapshot space into account.

I have a user walter on whom I try to do the following ZFS operations

bash-3.00# zfs get quota store/catB/home/walter

NAME                    PROPERTY  VALUE                   SOURCE

store/catB/home/walter  quota     14G                     local

bash-3.00# zfs set quota=4G store/catB/home/walter

cannot set property for 'store/catB/home/walter': size is less than current
used or reserved space

This obviously means that the user+snapshots have used space more than 4G,
so I do

bash-3.00# df -kh .

Filesystem             size   used  avail capacity  Mounted on

store/catB/home/walter
                        14G   3.8G   1.0G    80%    /store/catB/home/walter

Now here it shows that out of 14G, roughly around 4G is used and 1G is
available, this means around 9G is taken by snapshots.

So to get the snapshot list


bash-3.00# zfs list -r store/catB/home/walter
store/catB/home/[EMAIL PROTECTED]   118K      -  13.0G  -

store/catB/home/[EMAIL PROTECTED]      0      -  13.0G  -

store/catB/home/[EMAIL PROTECTED]      0      -  13.0G  -

store/catB/home/[EMAIL PROTECTED]   118K      -  13.0G  -

store/catB/home/[EMAIL PROTECTED]   118K      -  13.0G  -


Layman's method would be to try and total the space it lists against each
snapshot, but its not the case ZFS calculates. So I go on deleting the
snapshots, until the last one.


 bash-3.00# zfs list -r store/catB/home/walter

NAME                                          USED  AVAIL  REFER  MOUNTPOINT

store/catB/home/walter                       13.0G  1.00G  3.82G
/store/catB/home/walter

store/catB/home/[EMAIL PROTECTED]  9.18G      -  13.0G  -

And now I see that the last snapshot is showing the correct missing size.

The difficult I have now is to find out how to get this size without
destroying the snapshots. Every user is assigned a fixed quota, and when
snapshots are enabled it eats into the quota space, totalling all the
snapshots really does not give the exact space taken by snapshots.



Lets take the case of a different user. I am using a script downloaded over
the net.

zfs get -rHp used store/catB/home/peter|\
nawk '/@/ && $2 == "used" { tot++; total_space+=$3 ;\
        if ( $3 == 0 ) { empty++ }} \
END { printf("%d snapshots\n%d empty snapshots\n%2.2f G in %d snapshots\n",
tot,
        empty, total_space/(1024^3), tot - empty ) }'


55 snapshots
17 empty snapshots
0.42 G in 38 snapshots

bash-3.00# df -kh .
Filesystem             size   used  avail capacity  Mounted on
store/catB/home/peter
                       8.0G   2.6G   3.6G    43%    /store/catB/home/peter


This should be 2.6+3.6=6.2+.42= 6.8 say approx=7, but its still 1G short.


can anyone point me in the direction of finding the silent space taken by
snapshots?

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

Reply via email to