qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [Bug 1025244] Re: qcow2 image increasing disk size above th


From: Max Reitz
Subject: [Qemu-devel] [Bug 1025244] Re: qcow2 image increasing disk size above the virtual limit
Date: Tue, 16 Dec 2014 09:23:15 -0000

@Mario, in theory an image "that should be taking up 30 GB" with four
snapshots should be taking up at most about 150 GB, of course. Now the
question is what you mean by "should be taking up 30 GB" and by "is
taking 600+ GB".

For the latter, did you query the file length (ls -l) or the actual size
(qemu-img info, "disk size")?

For the former, if you have a virtual disk size of 1 TB and the guest
reports 30 GB are used, that doesn't mean that qemu knows that only 30
GB are used. If you delete a file in the guest, it will report less
space being used; however, qemu doesn't know about that unless the guest
bothers to discard the now unused sectors. If it doesn't (and I don't
see a reason why a guest should discard sectors on an HDD), the guest
will just remove the file metadata but the data will stay there (and may
be overwritten later by the guest when creating new files etc.). qemu
has no idea that that data is now unused, therefore it must treat those
sectors as being in use.

If your image indeed has a virtual disk size of 30 GB, has four
snapshots, is clean (qemu-img check) and does take up 600+ GB of actual
disk space, that should indeed not be happening (unless there's some
case I forgot to consider).

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1025244

Title:
  qcow2 image increasing disk size above the virtual limit

Status in QEMU:
  New
Status in qemu-kvm package in Ubuntu:
  Triaged

Bug description:
  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???

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1025244/+subscriptions



reply via email to

[Prev in Thread] Current Thread [Next in Thread]