Hi, I have launched a qemu process with the following options related to
emulated disk:

-drive
file=disk.qcow2,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

If I download files on guest OS to increase the used disk space, I can
observe that the disk file size is increased too. But if I delete the
downloaded files on the guest OS, the behavior on the host side is strange.
By using ls -alh or du --apparent-size commands I saw that the file size
has not decreased after deletion. But by using du -hs or qemu-img info
commands I observe that the disk file size has been decreased successfully.

I know that this is because of sparse blocks. But is there any way to tell
the underlying filesystem to use write operations on sparsed blocks?

I am using qemu version 5.2.0 and my host operating system is debian 11.
I even use fstrim command on guest OS but it doesn't have any impact.

Reply via email to