I'm using sparse raw image files for guest VMs and OCFS2 on the host (local-only, not clustered) for the reflink
feature. I understand from Googling around that OCFS2 is one of the filesystems that can punch holes back into sparse files.
If I understand correctly, it may be possible (and apparently can be achieved with XFS) to combine this feature with TRIM/discard support in the guest machines so that when files in the guest are deleted, space on the host is automatically reclaimed. However despite much experimentation, I haven't been able to demonstrate this working.
Is this possible, and if it depends on versions of the kernel and/or QEMU, what are the minimum versions I need? Also have I missed anything with the configuration? I've:
- mounted the (ext4) guest filesystem with the
discard
option in/etc/fstab
- tried the current beta of Debian Wheezy for host and guest, and CentOS 6.2 for host
- tried running
fstrim
on the guest (I getFITRIM ioctl failed: Operation not supported
—but I'm not 100% sure if this is relevent) - tried
bus=ide
andbus=virtio
(with CentOS 6.2 host)