ZFS wipe unused space

michabbs

Well-Known Member
May 5, 2020
141
20
58
I have pfSense router in VM. It is actually Freebsd with root on ZFS. The virtual disk is 16G, but 'df' (inside VM) shows only 3G is actually used.
Problem: The VM backup takes 16G.

I suppose this is because the Freebsd ZFS implementation does not wipe unused space, so from hypervisor perspective the disk is full. How can I zero the free space inside the VM? (If the unsused blocks are filled with zeros, they will be nicely compressed by PBS.)
 
Run in vm `sudo zpool trim zfs_pool_name`.

UPD. `sudo zpool status -t zfs_pool_name` will show trimming status
and `sudo zpool set autotrim=on zfs_pool_name` will enable periodic trimming of the zfs pool.
 
Last edited: