ZFS Used space by zvol after clone

FreeBSD Mastery: Advanced ZFS
Allan Jude and Michael Lucas
A zvol immediately claims all of the space you assigned for it. We created a 2 TB
volume so it uses 2 TB of space plus some extra for metadata. A brand-new volume hasn’t
used this much space yet—it hasn’t written a bunch of placeholder data to the pool or
anything like that. It’s only claimed that space via a refreservation.
OK, that is after creating of zvol:
Code:
zfs list -r vmhd2
NAME              USED  AVAIL     REFER  MOUNTPOINT
vmhd2             247G  1.68T       96K  /vmhd2
But the new zvol from snapshot uses only 8K
Code:
# zfs clone vmhd2/win2016@1 vmhd2/win2016T1
# zfs list -r vmhd2
NAME              USED  AVAIL     REFER  MOUNTPOINT
vmhd2             243G  1.68T       96K  /vmhd2
vmhd2/win2016     243G  1.91T     16.3G  -
vmhd2/win2016T1     8K  1.68T     16.3G  -
OK, this is just a diff, "copy-on-write".
The next case.
Code:
# zfs send vmhd2/win2016 | zfs recv vmhd2/win2016T2
# zfs list -r vmhd2
NAME              USED  AVAIL     REFER  MOUNTPOINT
vmhd2             263G  1.67T       96K  /vmhd2
vmhd2/win2016     243G  1.89T     17.3G  -
vmhd2/win2016T1  2.33G  1.67T     17.3G  -
vmhd2/win2016T2  17.3G  1.67T     17.3G  -
vmhd2/win2016T2 is a copy, isn't it? So why the USED space is not equal to vmhd2/win2016?

This topic created because each of copies/clones of the original file system has degraded performance of the guest FS.
189 vs 122 MB/s for read according CristalMark.
 
This smells like an oversight bug :)

To be fully accurate on Jude's claim that "a zvol immediately claims all the space you assigned for it": by default a refreservation is set so that space availability claims are guaranteed. Writing out a zvol fully under this cannot fail because the zfs command has already made the assurance that there will be enough space for it, and a refreservation was set so that ZFS will always enforce it as every data set is written to.

A clone probably should have this set too[*], but apparently doesn't. Running zfs set refreservation=auto vmhd/win2016T1 will set it so that this same guarantee happens. zfs set refreservation=none vmhd/win2016 can unset it, conversely (any other value for zvols doesn't make much sense).

[*] Snapshots don't need nor have a refreservation and the clone is probably just basing off of that.
 

chungy

Thanks! I found out more about ZFS.
But my problem is still not solved. The "Master" zvol shows pretty well i/o performance, whereas the copies no.
 
Regarding the send |recv half of your question -- maybe something changed since you created win2016?
E.g., you enabled compression. Or set a different blocksize.
Maybe deduplication is enabled on the pool.
Who knows... there are many variables and the information given to readers is very limited.
 
Eventually i found a culprit of the decreases i/o of the cloned systems!

Code:
# zfs get all vmhd2/win2016T2 | grep volmode
# OR
# zfs get volmode vmhd2/win2016T2

vmhd2/win2016T2  volmode               default                default
But in "Master volume" this param is dev.
Next we can change it on the fly!
Code:
# zfs set volmode=dev vmhd2/win2016T2
So we can get the whole speed from the zvol!

crystalmark.png
 
Back
Top