[PVE-User] New qcow2 hard disk creates a file with full disk size.

Dietmar Maurer dietmar at proxmox.com
Wed Jan 23 10:27:01 CET 2013


> I have seen that when I create a new qcow2 hard disk, the file created in the
> storate (a DRBD directory with ext4 file system) has the full size I have
> assigned to that hard disk.
> 
> For example, I have created a new 32GB qcow2 hard disk for a KVM vitual
> machine with ID 100. Before installing nothing into the virtual machine, if I
> execute the command ls -al I get:
> [...]
> -rw-r--r-- 1 root root 34365243392 Jan 23 10:01 vm-100-disk-1.qcow2 [...]
> That is, the file has already the 32GB that I have setup for the new hard disk.
> Why?

Yes, we pre-allocate metadata now.

> Before the last Proxmox update, when I created a new qcow2 hard drive the
> new file has only a few megabytes.
> 
> But if I execute the command du -sh over the virtual machine directory I
> get:
> [...]
> 5.5M
> [...]


The file is 'sparse', so it actually uses only a few MBs.

> If I copy the file to another computer, the copy has the 32GB too and if I
> execute du -sh over the file I get the 32GB size.

You need to use a tool which can copy sparse files (rsync).




More information about the pve-user mailing list