discard option on ext4 mounts in QEMU qcow2 images

Nate Collins ncollins at xes-inc.com
Mon Apr 25 18:29:25 UTC 2022


Hello,

Does anyone have any real-world statistics on the reliability and
performance of the ext4 discard option in QEMU VMs? I've heard it's
discouraged for physical devices, as some are inefficient in how
TRIM requests are processed, but I was wondering if there were any
drawbacks/warnings when it comes to virtual disks (in this case, QCOW2s).

I currently use either virtio-scsi or virtio-blk drivers for disk
images depending on what the host/guest support, and run TRIMs weekly,
but having an immediate freeing of space is desirable for many reasons.

Also wondering if snapshots on snapshotting filesystems (such as ZFS) can
run into corruption or other issues if snapshots are taken during a TRIM.

Thanks.



More information about the libvirt-users mailing list