ATA Trim for qcow(2)
Hi,
there is support for ext4 to use the trim ATA command when a block is freed. I read that there should be an extra command which does that freeing afterwards. So is it possible to use that information inside the qcow to mark those sectors as free? This would make it possible to shrink the size of an image significantly using some offline (maybe also some online) tools.
Best regards,
Emil
Quoted 5 lines · Emil Langrock
there is support for ext4 to use the trim ATA command when a block is freed. I read that there should be an extra command which does that freeing afterwards. So is it possible to use that information inside the qcow to mark those sectors as free? This would make it possible to shrink the size of an image significantly using some offline (maybe also some online) tools.
If the qemu block device can write zeroes out to TRIMmed space, a simple cp --sparse=always <file> <file> (on a raw image) can save all that zeroed space; I recall looking into this sort of thing a while ago and it was fairly simple to write a tool to wipe out the zero blocks in a qcow2 file, too.
- Matt
Signature · 4 lines
"The user-friendly computer is a red herring. The user-friendliness of a book just makes it easier to turn pages. There's nothing user-friendly about learning to read." -- Alan Kay
Quoted 5 lines · Emil Langrock
there is support for ext4 to use the trim ATA command when a block is freed. I read that there should be an extra command which does that freeing afterwards. So is it possible to use that information inside the qcow to mark those sectors as free? This would make it possible to shrink the size of an image significantly using some offline (maybe also some online) tools.
There is currently no TRIM support in qcow2. Christoph Hellwig recently added TRIM support to raw images on an XFS host file system. In the future we'll see wider support.
Stefan