1

I am using ubuntu 12.04 and have seen this: https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/1025244

Our qcow2 images are growing far beyond what they should... with some of them growing to as much as 600gb when they should have only 20-30gb

Others are growing more slowly but still growing... normally cow images that should have a maximum of 10Gb are now showing 20gb+ this is insane! What i mean by growing is that their virtual size should be 10gb max yet they grow far beyond that on the qcow2 file

We are thin-provisioning the disks with qemu-img

I know i can temporarily solve this by reclaiming unused space with virt-sparsify.

We will soon have a big problem when the images are too big that i can't virt-sparsify them anymore to get the space back (since double the size is needed for the temporary copy)

We do have snapshots on the machines...

My questions are:

  • Does this ONLY happen because they are thin provisioned?
  • If I preallocate them will this go away?
  • How can I avoid this? changing to raw? preallocating?
  • Any way I can reclaim that space without needing double the space?
0

1 Answer 1

2

Several things:

  1. When you use sparse images, they will grow when the VM writes data into the disks.
  2. A snapshot is a new sparse image, able to grow to the same size as the original. So if you take a 10Gb disk, fill it up to 10Gb, and then snapshot it, the snapshot will also be able to grow to 20Gb. In the long run, this is always a problem, which is one of the resons snapshots in production are never a good idea.
  3. If you create an image with qemu-img you give the max size in the command. The image should not be able to grow beyond that size, if it does - you're seeing a bug.
  4. To avoid image sprawl, avoid snapshots, especially long running snapshots, and whenever possible stick to raw, preallocated images.
2
  • Hi dyasny, main problem of mine is "The image should not be able to grow beyond that size, if it does - you're seeing a bug." <- they are growing to a size bigger than they were allocated. So another question: you say "specially long running snapshots", why these specially? Dec 12, 2014 at 20:11
  • because when you take a snapshot, run it for a bit, to test stuff or perform a backup, it will not have the chance to grow or affect VM performance.
    – dyasny
    Dec 13, 2014 at 1:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .