Skip to contentSkip to conversation

TRIM, UNMAP and QCOW2 release of block information - Thin provisioning

Qemu-devel Gerhard Wiesinger 3 participants 3 messages Aug 12, 2012 – Aug 15, 2012

lore
Share & tools
lore
#0 lore raw

Hello,

As far as I saw QEMU/KVM supports the trim command on IDE/SATA devices and the UNMAP command on SCSI devices/disks (thanks Paolo Bonzini). Will the qcow2 format (or other formats) use this information and also release the blocks for thin provisioning to save disk space on filesystems?

VirtualBox also has such a feature in the new beta version:
http://www.fb-developers.info/blog/2012/virtualbox-v4-2-is-coming/

Thnx.

Ciao,
Gerhard

Signature · 1 line
http://www.wiesinger.com/
#1 lore raw
Quoted 7 lines · Gerhard Wiesinger

As far as I saw QEMU/KVM supports the trim command on IDE/SATA devices and the UNMAP command on SCSI devices/disks (thanks Paolo Bonzini). Will the qcow2 format (or other formats) use this information and also release the blocks for thin provisioning to save disk space on filesystems?

VirtualBox also has such a feature in the new beta version:
http://www.fb-developers.info/blog/2012/virtualbox-v4-2-is-coming/

This has recently been discussed, please search the list for more info from Kevin Wolf or Paolo Bonzini.

qcow2 marks the discarded blocks as free and will reuse them in future allocations. It does *not* discard at the OS level.

For raw files you can get discard to work on an xfs host file system. In the future ext4 support can also be added.

Stefan

#2 lore raw

Am 13.08.2012 10:31, schrieb Stefan Hajnoczi:

Quoted 9 lines · Gerhard Wiesinger
Quoted 7 lines

As far as I saw QEMU/KVM supports the trim command on IDE/SATA devices and the UNMAP command on SCSI devices/disks (thanks Paolo Bonzini). Will the qcow2 format (or other formats) use this information and also release the blocks for thin provisioning to save disk space on filesystems?

VirtualBox also has such a feature in the new beta version:
http://www.fb-developers.info/blog/2012/virtualbox-v4-2-is-coming/

Quoted 8 lines

This has recently been discussed, please search the list for more info from Kevin Wolf or Paolo Bonzini.

qcow2 marks the discarded blocks as free and will reuse them in future allocations. It does *not* discard at the OS level.

For raw files you can get discard to work on an xfs host file system. In the future ext4 support can also be added.

The problem with it is that passing discards through to the file system, or even handling them at all isn't always wanted. It is already a slow operation for itself, but it also makes the next write access slower and can cause fragmentation.

So you'd really want some more options to configure it, and I believe to achieve what we want, changes are not only required to qemu, but to both host and guest kernel. Paolo is looking into this.

Btw, the more interesting news for me in the VBox link you posted is that they seem to have implemented QED, qcow1, and read-only qcow2.

Kevin