[virt-tools-list] Storage image files and permissions
Eric Blake
eblake at redhat.com
Wed Nov 28 14:00:51 UTC 2018
On 11/28/18 7:41 AM, Eric Blake wrote:
>> I relied on the "file" tool provided by Archlinux. It says "QCOW3" as
>> the file type by its contents.
>
> No, it says "QCOW Image (v3)", and means qcow2v3, because file is not
> distinguishing between 'qcow' and 'qcow2'. It would be worth a bug
> report to the 'file' database maintainers to update their magic file to
> distinguish 'qcow' (the old v1 that is no longer used anywhere) from
> 'qcow2' (with both 'qcow2 v2' and 'qcow2 v3' flavors).
Additional information:
The old qcow (v1) format is lousy - it was not created with endian and
sizing considerations, to the point that you may have a different image
created depending on whether the host was little- or big-endian, and 32-
or 64-bit (the file format does not encode the creation architecture,
but you can generally make safe guesses as to what happened). We've
tightened it up over the years (see qemu commit ea54feff58 that made
padding in the header explicit, rather than relying on the compiler to
pick the right amount of space), but it is still not an ideal header.
Also, it lacks a refcount table, making it fairly easy to corrupt the
image if writes don't flush in the correct order, and rather
time-consuming to expand an existing image to a larger size. qemu
provides a separate driver for qcow images, and recommends that no one
create new files in that format.
The new qcow2 format is architecture-independent, and lists header
members in a different order than the old qcow format (the 'magic' and
'version' fields are in the same place, but other fields with common
names like 'crypt_method' are moved around compared to v1). Both v2 and
v3 images can be handled by a single driver (qemu has just a qcow2
driver), and you can even convert between the two (v2 upgrading to v3 is
always possible, v3 downgrading to v2 depends on whether the image
utilized any v3-only features). While v2 images lack features that only
v3 can support, at least the refcount table is common between the two,
and it is much easier and faster to write to qcow2 files of either
version. RHEL (or CentOS) 6 is the last major distro that was limited
to only v2 images, so these days, using v3 is a safe default.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
More information about the virt-tools-list
mailing list