Problem/Justification
This allows ZFS to handle all zero blocks in Virtual Machines better (when using compression) and therefore will improve disk handling and usage.
Related links
- KVM and ZVol TRIM/DISCARD passthrough handling clarification - #3 by shoulders
- Invocation — QEMU documentation
- detect-zeroes is “off”, “on” or “unmap” and enables the automatic conversion of plain zero writes by the OS to driver specific optimized zero write commands. You may even choose “unmap” if discard is set to “unmap” to allow a zero write to be converted to an
unmap
operation.
- detect-zeroes is “off”, “on” or “unmap” and enables the automatic conversion of plain zero writes by the OS to driver specific optimized zero write commands. You may even choose “unmap” if discard is set to “unmap” to allow a zero write to be converted to an
Impact
Some hard core VirtualMAchine users will apprciate this to get better comprression with lz4 from this additional option in a virtual machine config.
the underlying technology should already be present in TrueNAS SCALE Dragonfish and above, it just need this extra option adding to a config.
User Story
A user has a sparse Virtual disk which he then zero fills. The disk is now at full usage but he has no “real” data on it, but because it is zero-filled, the blocks are not released because they are classed as still used.
If the detect-zeroes
option is on, all of the blocks can be recognised as zero blocks and the information passed up to the ZFS which if using lz4
can heavily compress all of these blocks reducing the virtual disk back to a very small size.
When an OS is installed that is unmap
capable the blocks can be naturally released using the GuestOS TRIM operations.