[libvirt-users] Questions about qcow2 file size management

Jérôme jerome at jolimont.fr
Wed Oct 14 14:43:05 UTC 2015

Le 2015-10-14 13:27, Jérôme a écrit :

>> TRIM is needed to indicate that space is reclaimable. This needs file
>> system support (no fat32, e.g.), and support by QEMU('s I/O driver).
>> Once Qemu is set up to accept TRIM, you can either enable the discard
>> mount option, or set up an fstrim cron job.

Thanks. I read stuff about that and it's becoming clearer now. 

These pages are the most complete explanations I found:

Unfortunately, after stopping the VM, editing the config file to add
"discard=unmap" and booting the VM again, fstrim does not work:

fstrim: /: the discard operation is not supported

The doc cited above says the feature needs virtio-scsi so I modified the
guest parameters using virt-manager to set virtio-scsi instead of virtio

I don't know how to set "discard="unmap" with virt-manager. Is it

I can modify the .xml file using vi, but I'd rather stick to
virt-manager if possible, for me and my colleagues. However, for those
tests, I diff the .xml file everytime to check what happens underneath.

Once virtio-scsi is used, whether or not I set "discard="unmap" (through
manually .xml file edition), as long as virtio-scsi is specified, the
fstrim command works or seems to:

#fstrim -v / 
/: 1.3 GiB (1372569600 bytes) trimmed

However, in any case, I don't see any change in the space used by the VM
file as seen from the host. It does not shrink.

Anything else I should do?

Anything I could check?



More information about the libvirt-users mailing list