summary refs log tree commit diff stats
path: root/results/scraper/launchpad-without-comments/1025244
blob: 3512b317c1b83ecea0f60a78c20d31aef3f9848b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
qcow2 image increasing disk size above the virtual limit

Using qemu/kvm, qcow2 images, ext4 file systems on both guest and host
 Host and Guest: Ubuntu server 12.04 64bit
To create an image I did this:

qemu-img create -f qcow2 -o preallocation=metadata ubuntu-pdc-vda.img 10737418240 (not sure about the exact bytes, but around this)
ls -l ubuntu-pdc-vda.img
fallocate -l theSizeInBytesFromAbove ubuntu-pdc-vda.img

The problem is that the image is growing progressively and has obviously no limit, although I gave it one. The root filesystem's image is the same case:

qemu-img info ubuntu-pdc-vda.img
 image: ubuntu-pdc-vda.img
 file format: qcow2
 virtual size: 10G (10737418240 bytes)
 disk size: 14G
 cluster_size: 65536

and for confirmation:
 du -sh ubuntu-pdc-vda.img
 15G ubuntu-pdc-vda.img

I made a test and saw that when I delete something from the guest, the real size of the image is not decreasing (I read it is normal). OK, but when I write something again, it doesn't use the freed space, but instead grows the image. So for example:
 1. The initial physical size of the image is 1GB.
 2. I copy 1GB of data in the guest. It's physical size becomes 2GB.
 3. I delete this data (1GB). The physical size of the image remains 2GB.
 4. I copy another 1GB of data to the guest.
 5. The physical size of the image becomes 3GB.
 6. And so on with no limit. It doesn't care if the virtual size is less.

Is this normal - the real/physical size of the image to be larger than the virtual limit???