zvol, refreservation and used space

Status
Not open for further replies.

max322223

Dabbler
Joined
Nov 23, 2015
Messages
13
So, I have this zvol
Code:
~# zfs list -ro space Main/Backups
NAME               AVAIL   USED  USEDSNAP  USEDDS  USEDREFRESERV  USEDCHILD
Main/Backups       5.13T  3.88T     1.02T    778G          2.10T          0

From what I understand, it has 778GB of actual data on disk, there's 1.02T worth of snapshots, and a refreservation of 2.1T. What makes no sense to me is why the used space is calculated as the sum of all three? Why not max(used by data, reserved)+snapshots? As it is, it looks like the 2.1T reservation is essentially wasted space that I will never be able to use. I looked through the Oracle docs on reservations, so I can blow away the reservation, but it would be great to understand why is it working this way, and what it is that I am missing. :)
 

Mirfster

Doesn't know what he's talking about
Joined
Oct 2, 2015
Messages
3,215

max322223

Dabbler
Joined
Nov 23, 2015
Messages
13
I didn't create the refreseration explicitly, that's for sure. I believe it was create by the FreeNAS UI as a side-effect of me creating a zvol. (There seems to be a related bug in the mechanism -- when I resized the zvol through the UI later, the reservation size was not updated)
 

meku

Dabbler
Joined
May 4, 2014
Messages
34
The used space for a zvol is USEDSNAP + USEDDS + USEDREFRESERV.

I also wondered why the dataset space was being added instead of being included in the reserved space but this appears to be normal behaviour for how refreservation works. I'll try to explain the logic for it but excuse me in advance for mistakes as I'm still wrapping my head around it.

Snapshots take up space in your pool instead of the zvol, because the refreservation is reserved for your live data. This means no matter how many snapshots you have it will not adversely affect the space in your zvol.

Now the part which confused me at first: the space used by the DATASET is also added to the used space. Why is this added instead of being included in the reservation? Well imagine that you were to overwrite your entire dataset, the space used by your dataset would immediately become space used by snapshots.

You can verify this behaviour (on a test pool), by removing all the snapshots. Without snapshots the space used by the dataset is explicitly subtracted from the refreservation and the total space used is the size of the reservation.
 
Status
Not open for further replies.
Top