So I have been testing ZFS as a proxmox backend to a Windows guest. When i delete files from the VM the used category for that VM disk in zfs list does not go down. refreservation=0. Am I missing something?
Yes, you need to enable trim all the way down the stack–inside the VM, and on the ZFS host.
Without trim enabled inside the VM, the deleted sectors are marked deleted inside the VM’s filesystem, but that information doesn’t get passed to the VM’s “hardware.” Without trim enabled outside the VM, the VM passes the trim information to its “hardware”, but the host doesn’t pass the commands on to ZFS.
To build upon Jim’s reply…
- Make sure VM Windows thinks the drive is an SSD and trim is enabled.
- When you delete the files make sure you don’t delete to the Recycle Bin. Use Shift-Del to permanently delete the files. By default Windows doesn’t really delete the files. Even then Windows doesn’t always mark the clusters free/trimmable.
- Get MS SysInternals sdelete program and schedule it to run nightly on the VM to zero out freespace. Even if trim doesn’t happen within the VM, writing all zeros to a sector on the underlying SSD will trim it out or at the very least let zfs compress it all to heck.
- Make sure you run the built-in disk cleanup app regularly. Windows downloads or generates all kinds of crap in the background. This will clean that stuff up.