KVM add the `detect-zeroes` feature

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

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.

1 Like