This question is "kinda" about Proxmox VM’s but probably more to do with LVM’s

I’ll explain.

I created a VM on a Promox server with a partition of 20Gb on the local-lvm

When I do a lvdisplay I do indeed see that local-lvm on path /dev/pve/vm-101-disk-1 and here’s the key fact the Mapped Size is showing 15%.

I expected that because that roughly matches the amount of actual used space on that VM.

For various reasons I needed to move that VM from Proxmox to VMWare which I did by moving the partition using the command :-

qemu-img convert -p -O vmdk /dev/pve/vm-101-disk-1 /mnt/vmwks/vm-000-disk-1.vmdk

Happy days…. I then worked on my VM and then put it back on Proxmox server using :-

qemu-img convert -p -O raw /mnt/vmwks/vm-000-disk-1.vmdk /dev/pve/vm-101-disk-1


Now when I do a lvdisplay the mapped size is now showing as 100% and not around the 15-16% I was expecting.

I made sure the VMDK file was a flat single file (I.e. the full 20Gb in size) but clearly the qemu-img isn’t showing the sparse space as free and therefore showing the lv as 100%. Of course inside the VM its reporting the free space as right and showing 84% free. But the lvdisplay figures changed from the original 15% to 100%

What have I done wrong when using QEMU-IMG?

I tried using DD (dd if=/mnt/vmwks/vm-000-disk-1-flat.vmdk of=/dev/pve/vm-101-disk-1) and that made no difference, still 100%

Any ideas??


Previously, the LV was created using a thin or sparse volume, which only allocates the blocks that have been written to, so the volume only occupies that much space in the volume group. When you write the 20 GB image back to the LV, then you have written 100% of the blocks (even the blocks that were all zeroes) so now the entire 20GB must be allocated in the volume group.

I think you can use dd_rescue -a to put the file back into a logical volume without writing the full 20GB. The -a flag is for writing a sparse file where blocks that are all zeroes are skipped and not written to disk. You will want the -b block size flag to match the "PE Size" shown by vgdisplay (eg -b 4M) so something like

dd_rescue -a -b 4M vm-000-disk-1-flat.vmdk of=/dev/pve/vm-101-disk-1

The GNU ddrescue program uses the -S flag instead for sparse mode.

| improve this answer | |
  • Sadly that didn't work... I'm guessing dd_rescue doesn't support lvm devices because I get the following error. ddrescue: Output file exists and is not a regular file. ddrescue: Only regular files can be sparse. – Ian Chilvers May 18 '17 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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