I have a qcow2 file on my filesystem and I am trying to find the size of that file.
For this, when I do a ls -l
in the location where the file is stored, I get 13041664, which means the file size is around 13 MB and when I do a file <filename>
, I get:
disk: QEMU QCOW Image (v2), has backing file (path
/var/lib/nova/instances/_base/035db99541e92b5cca93bf18a997d626f), 21474836480 bytes
which, I presume, says the filesize is around 21 GB.
Is this my misinterpretation of the command output or is something else going on inside the filesystem(thin provisioning kind of thing)?
UPDATE: When I do a ls -l on var/lib/nova/instances/_base/035db99541e92b5cca93bf18a997d626f
, I get a ls: cannot access /var/lib/nova/instances/_base/035db99541e92b5cca93bf18a997d626f: No such file or directory
and its correct that I have no file there
UPDATE 2: The output of qemu-img info <filename>
is as follows:
image: disk
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 12M
cluster_size: 65536
backing file: /var/lib/nova/instances/_base/035db99541e92b5cca93bf18a997d626f512b73d (actual path: /var/lib/nova/instances/_base/035db99541e92b5cca93bf18a997d626f512b73d)
From Qcow in Wikipedia:
So the file size is really 13MB, but it can grow up to 20GB when data is written to it. Example:
An empty qcow2 file was created. It can hold a 2GB filesystem, but for now it only occupies 197KB in disk.
From http://en.wikibooks.org/wiki/QEMU/Images:
From the
qemu-img
manpage:Example:
In your case /var/lib/nova/instances/_base/035db99541e92b5cca93bf18a997d626f512b73d is the backing file. I don't know what is the expected bahavior if you try to use your qcow file without the backing file.
About
/var/lib/nova/instances
in OpenStack documentation: