the size of qcow2 disk file grows rapidly

*爱你&永不变心* 提交于 2019-12-12 05:02:26

问题


Hello everyone!I am learning OpenStack、qemu and kvm.

As we know, QCOW2 is a disk file format of kvm virtual machine. I found a phenomenon, that is the size of QCOW2 disk file grows rapidly. I created a kvm virtual machine which used QCOW2 disk file and win7 operating system. I didn't do any action for it. But a day later, the size of its QCOW2 disk file was increased by more than 1G.

I know that shutting down the operating system's automatically updates will slow the growth of the QCOW2 disk file size. Can you tell me whether you have other more effective ways? I would be appreciated if I can get your help.


回答1:


qcow will grow up to the size specified, and only with new writes to previously untouched blocks. If your guest is deleting and writing files rapidly, it will fill that space out quickly, while the guest will still show plenty of unused space, simply because you also delete files.

You can deduplicate the qcow2 file, simply zero-fill it using sdelete on windows or dd if=/dev/zero of=/some/path/to/file on linux, then delete the zero file and run qemu-img convert on the file - qemu-img will create a new file without the zero filled blocks.

For more information look at https://serverfault.com/questions/547374/qcow2-overlay-growing-too-rapidly



来源:https://stackoverflow.com/questions/37337557/the-size-of-qcow2-disk-file-grows-rapidly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!