qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] What does "COW" mean?


From: Jakob Bohm
Subject: Re: [Qemu-discuss] What does "COW" mean?
Date: Tue, 02 Sep 2014 17:15:43 +0200
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0

On 02/09/2014 10:33, shhuiw wrote:
Hi,

I'm new to qemu community, and I'm trying the COW image format (old but 
simple:-).
I have read through its source code, and didn't find anything about 'copy on 
write'.
I wonder wthat "COW" stands for?
COW = Copy On Write is a general computing technique where something (in this case a disk image file) doesn't really copy data until someone actual tries to write to (change) their copy, then at that very moment, it makes a real copy for that someone
to write to.

In qemu context this is used when you make a "snapshot" copy of an entire virtual disk and tells qemu that the running virtual machine should only write to one of the copies while the other copies are kept unchanged for any reason (such as backup). When you tell qemu to do this with a COW disk image format, it just makes copies some data about where different parts of the disk image are stored in the file, and sets some flags such that when the virtual machine actually writes to the disk image, it is given its own copy (in the COW file) of the part of the disk it has written to. For the (usually at least 90%) of the disk that the virtual machine doesn't write to, it just reads back from the
original copy without wasting time and disk space on an actual copy.

As a bonus feature, some recent versions of the qcow2 file format also uses this technique for any part of the disk that contains all zeroes, which saves space as long as the virtual machine doesn't completely fill its virtual disk. Reading back zeroes from nowhere is faster and cheaper than reading zeroes from a real disk, making this
a win-win in most situations.

Enjoy

Jakob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]