On which version of qemu the discard option is supported? I have emulated a VM with below qemu options related to disk type:
-drive file=disk.img,if=none,id=disk0,l2-cache- size=8M,format=qcow2,discard=on,detect-zeroes=unmap,aio=io_uring -device virtio-blk-pci,drive=disk0,scsi=off,bootindex=2 the disk file on the host side is located on xfs mountpoint on RAID level 10 array. After I downloaded a file with 1GB size on the guest OS, I saw the size of the disk file on the host has been increased as well. But when I delete the downloaded file and issue fstrim --all -v command, the disk file on host has not been decreased. The version of qemu I'm using is 5.2.0 -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1523246 Title: Virtio-blk does not support TRIM Status in QEMU: Fix Released Bug description: When model=virtio is used, TRIM is not supported. # mount -o discard /dev/vda4 /mnt # mount | tail -1 /dev/vda4 on /mnt type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096) # fstrim /mnt/ fstrim: /mnt/: the discard operation is not supported Booting without model=virtio allows using TRIM (in Windows as well). Full QEMU line: qemu-system-x86_64 -enable-kvm -cpu host -bios /usr/share/ovmf/ovmf_x64.bin -smp 2 -m 7G -vga qxl -usbdevice tablet -net nic,model=virtio -net user -drive discard=unmap,detect- zeroes=unmap,cache=none,file=vms/win10.hd.img.vmdk,format=vmdk,if=virtio To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1523246/+subscriptions