Ask Your Question

how copy on write in qcow2 works?

asked 2017-07-03 06:24:18 -0500

br gravatar image

updated 2017-07-03 06:24:46 -0500

Copy-on-write is a optimization strategy that postpones the actual copying of data until the first write to the copy. In case of Fork(), creates an exact copy of a process, including all its memory. The fork() call doesn't actually copy any memory. Instead, it tells the kernel to trap any attempt to modify memory and copy the corresponding memory pages only when either a child or a parent process attempts to modify them.

I am not able to understand how in case of images copy on write works? I know the image will be copied to compute node while launching the instance. Is it copy on write in case of images means "if we launch multiple instances using particular image, will not create multiple copies of image until unless we save data in the instance"?

please help me to understand correctly?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-07-03 10:42:57 -0500

updated 2017-07-03 10:43:32 -0500

While conceptually similar, qcow2 copy-on-write has nothing to do with fork(), which implements copy-on-write for RAM, not storage. See the wikipedia page, which explains it well, I think.

In the case of Nova instances, by default, a copy of the image will be made to the compute node where the instance runs. A qcow2 file is then created with the image copy as backing file; conceptually: qemu-img -f qcow2 -o backing_file=copy-of-image instancedisk.qcow2. The instance is the launched with instancedisk.qcow2 as root disk.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2017-07-03 06:24:18 -0500

Seen: 587 times

Last updated: Jul 03 '17