Qcow
Encyclopedia
qcow stands for "QEMU Copy On Write
Copy-on-write
Copy-on-write is an optimization strategy used in computer programming. The fundamental idea is that if multiple callers ask for resources which are initially indistinguishable, they can all be given pointers to the same resource...

" and denotes a disk storage optimization strategy that delays allocation of storage until it is actually needed. QEMU
QEMU
QEMU is a processor emulator that relies on dynamic binary translation to achieve a reasonable speed while being easy to port on new host CPU architectures....

 is an emulator and virtual machine container, and it can use a variety of virtual disk image
Disk image
A disk image is a single file or storage device containing the complete contents and structure representing a data storage medium or device, such as a hard drive, tape drive, floppy disk, CD/DVD/BD, or USB flash drive, although an image of an optical disc may be referred to as an optical disc image...

s which are generally associated with specific guests operating systems. The set of possible disk image formats have commonly accepted short names:
  • vvfat - Virtual VFAT
  • vpc
    Windows Virtual PC
    Windows Virtual PC is a virtualization program for Microsoft Windows. In July 2006 Microsoft released the Windows-hosted version as a free product...

     - Windows Virtual PC
  • bochs
    Bochs
    Bochs is a portable x86 and x86-64 IBM PC compatible emulator and debugger mostly written in C++ and distributed as free software under GNU Lesser General Public License...

     - Bochs file system
  • dmg - Macintosh disk image
  • cloop
    Cloop
    The compressed loopback device or cloop is a module for the Linux kernel. It adds support for transparently decompressed, read-only block devices. It is not a compressed file system in itself....

     - Linux compressed loop
  • vmdk
    VMDK
    The VMDK file format is a type of virtual appliance developed for VMware products. The format is open/documented.-Products that use the format:* VMware Workstation* VMware Player* VMware Server* VMware Fusion...

     - VMware virtual machine disk format
  • qcow - QEMU Copy-on-write
  • qcow2 - QEMU Copy-on-write (new in version 0.9)
  • raw
    IMG (file format)
    The IMG file format is one of the following files:# A CD or DVD image file, essentially equivalent to an ISO file. On such a file, simply changing the extension from IMG to ISO can make it usable as the latter by most programs....

     - Raw file system (no special format)
  • cow
    Copy-on-write
    Copy-on-write is an optimization strategy used in computer programming. The fundamental idea is that if multiple callers ask for resources which are initially indistinguishable, they can all be given pointers to the same resource...

     - User-mode Linux copy-on-write

qcow

qcow images grow as data is added, and support AES
Advanced Encryption Standard
Advanced Encryption Standard is a specification for the encryption of electronic data. It has been adopted by the U.S. government and is now used worldwide. It supersedes DES...

 encryption
Encryption
In cryptography, encryption is the process of transforming information using an algorithm to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key. The result of the process is encrypted information...

 or transparent decompression.

One disadvantage of qcow images is that they can NOT be mounted with offset, in the way that raw images can be mounted with mount /path/to/image.img /mount/path -o loop,offset=32256.

qcow has been replaced by qcow2, but qemu and xen have retained the format for backwards compatibility, and users should consider converting disk images to qcow2 with:
qemu-img convert -f qcow -O qcow2 imagename-qcow imagename-qcow2

qcow2

qcow2 is a newer version of the qcow copy-on-write
Copy-on-write
Copy-on-write is an optimization strategy used in computer programming. The fundamental idea is that if multiple callers ask for resources which are initially indistinguishable, they can all be given pointers to the same resource...

 format. QEMU can use a base image which is read-only, and store all writes to the qcow2 image. Among the QEMU supported formats, this is the most versatile format. Use it to have smaller images (useful if your filesystem does not support holes, for example on FAT32), optional AES encryption, zlib based compression and support of multiple VM snapshots.

Mounting qcow2 images

For various reasons it might be useful to mount the disk image inside the qcow2 file, such as to edit configurations before starting the virtual machine, or simply to recover files from a backup. Since the qcow2 format is not a simple linear block format like disks and raw files, it is necessary to use the network block device tool that's part of the qemu toolkit like this:
qemu-nbd image.img

That nbd can then be mounted on the local machine thus:
modprobe nbd max_part=63
nbd-client localhost 1024 /dev/nbd0
mount /dev/nbd0p1 /mnt/qemu

or even a remote machine thus:
modprobe nbd max_part=63
nbd-client somehostname 1024 /dev/nbd0
mount /dev/nbd0p1 /mnt/qemu

when the image is to be mounted on the local machine, it is possible to do it in one stage thus:
qemu-nbd --connect=/dev/nbd0 image.img
mount /dev/nbd0p1 /mnt/qemu

it is recommended to do a fsck before mounting:
fsck /dev/nbd0p1

when finished, umount the device before stopping the qemu-nbd or nbd-client processes:
umount /dev/nbd0p1

Note that in the modprobe
Modprobe
modprobe is a Linux program originally written by Rusty Russell and used to add a loadable kernel module to the Linux kernel or to remove an LKM from the kernel...

 command, max_part is the number of maximum partitions to support. NBD
Network block device
In Linux, a network block device is a device node whose content is provided by a remote machine. Typically, network block devices are used to access a storage device that does not physically reside in the local machine but on a remote one...

is the protocol that is used to share images over the network. It will be used to access image data in this case. The nbdXpY subdevices are the partitions within the nbdX virtual disk.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK