Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a new virtual disk using the following command*:

$ virsh vol-create-as --format=qcow2 guest-disks disk_instid.24_diskid.30 8192M
Vol disk_instid.24_diskid.30 created

The "guest-disks" pool is a simple "dir"-Type pool. As you see, the command succeeds, but when I'm trying to install an operating system in the new domain, it only shows up as a fraction of a megabyte in size:

# fdisk -l /dev/sda 

Disk /dev/sda: 0 MB, 262144 bytes
1 heads, 1 sectors/track, 512 cylinders, total 512 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sda doesn't contain a valid partition table

As you see, the size is completely wrong. Any idea why this is?

*Don't mind the numbers - it's part of a tool that creates domains automatically.

share|improve this question
up vote 3 down vote accepted

Okay, I figured it out on my own. If you don't specify the format in the domain XML, Libvirt expects it to be of the "raw" format by default, which does not expand with usage, but needs to be fully allocated (see answer by dyasny). The ~200KB are the initial data structure of the qcow2 format.

What needs to be done is this: You must add a "driver" element to the "disk" part of the domain xml, explicitly mentioning the qcow2 format, like so:

<disk type="file" device="disk">
    <driver name="qemu" type="qcow2" />
    <source file="/var/lib/virt/guest-disks/disk_instid.24_diskid.30" />
    <target dev="sda" />

After this change, the domain OS sees the disk as expected.

share|improve this answer
+1: please set this as the answer for the question. If the vm was created with virt-install, ,format=qcow2 has to be added after the filename of the image used. Some keywords for google searches: 202.2 kB ATA QEMU HARDDISK. – ceztko Apr 19 '12 at 11:43

try with --allocation 8192M this will allocate the disk size

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.