简体   繁体   中英

the size of qcow2 disk file grows rapidly

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM