简体   繁体   English

qcow2磁盘文件的大小快速增长

[英]the size of qcow2 disk file grows rapidly

Hello everyone!I am learning OpenStack、qemu and kvm. 大家好!我正在学习OpenStack,qemu和kvm。

As we know, QCOW2 is a disk file format of kvm virtual machine. 众所周知,QCOW2是kvm虚拟机的磁盘文件格式。 I found a phenomenon, that is the size of QCOW2 disk file grows rapidly. 我发现了一种现象,那就是QCOW2磁盘文件的大小迅速增长。 I created a kvm virtual machine which used QCOW2 disk file and win7 operating system. 我创建了一个使用QCOW2磁盘文件和win7操作系统的kvm虚拟机。 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. 但是一天后,其QCOW2磁盘文件的大小增加了1G以上。

I know that shutting down the operating system's automatically updates will slow the growth of the QCOW2 disk file size. 我知道关闭操作系统的自动更新会减慢QCOW2磁盘文件大小的增长。 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. qcow将增长到指定的大小,并且仅对先前未触及的块进行新写入。 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. 如果guest虚拟机正在快速删除和写入文件,它将迅速填满该空间,而guest虚拟机仍会显示大量未使用的空间,这仅仅是因为您还删除了文件。

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. 您可以删除qcow2文件的重复数据,只需在Windows上使用sdeletedd if=/dev/zero of=/some/path/to/file sdeletedd if=/dev/zero of=/some/path/to/file对其进行零填充,然后删除零文件并在Windows上运行qemu-img convert文件-qemu-img将创建一个没有零填充块的新文件。

For more information look at https://serverfault.com/questions/547374/qcow2-overlay-growing-too-rapidly 有关更多信息, 参见https://serverfault.com/questions/547374/qcow2-overlay-growing-too-rapidly

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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