Discard=Unmap on Virtio Disks

Recommended Posts

I ran across an article whose author claimed that on recent versions of qemu,  discard=unmap was functional on virtio disks.  So I did some testing.


I have not run all permutations, but have tested:

  Unraid 6.9.2

  UEFI and Seabios VMs

  Q35-5.1 and i440fx-5.1 VMs

  Windows 10 and Windows 11 with the latest virtio drivers, virtio-win-0.1.196.iso

  Ubuntu 21.4

  raw and qcow2 vdisks

  vdisks on XFS and BTRFS disks

  vdisks with and without the copy-on-write attribute set


In all cases, the virtio disk was functionally equivalent to a virtio-scsi disk.  On file deletion, windows unmapped blocks immediately.  Linux unmapped blocks after running fstrim.



Edited by aim60
  • Like 5
Link to comment
  • 3 months later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.