I have a proxmox installation. I'd like to import a vmdk to a lvm and the procedure is:

$ qemu-img convert -p -f vmdk "IE11 - Win7-disk1.vmdk" -O raw "IE11 - Win7-disk1.raw"

and then:

$ dd if="IE11 - Win7-disk1.raw" bs=1M|pv| dd of=/dev/mapper/pve-vm--103--disk--1

And that works fine.

But there are 8.8GB data on a 127GB virtual drive:

$ qemu-img info "IE11 - Win7-disk1.raw"
image: IE11 - Win7-disk1.raw
file format: raw
virtual size: 127G (136365211648 bytes)
disk size: 8.8G

And when I "dd" the raw drive I see 127GB copied when only 8.8G of them matter. And that's painstakingly slow.

Is there a better way?

  • 1
    Have you looked at the bs paramater to increase the side of each 'chunk' that dd copies? e. g. dd if=/path/to/input of=/path/to/output bs=128M. – DopeGhoti Oct 13 '16 at 21:48
  • I usually do bs=1M, but the problem is not that, but the fact that it copies 127GB instead of 8.8GB. I'll update the question and add the bs. – mist Oct 13 '16 at 22:07

A faster way is not to use dd

pv < "IE11 - Win7-disk1.raw" > /dev/mapper/pve-vm--103--disk--1

The fastest is to use cat directly

cat "IE11 - Win7-disk1.raw" > /dev/mapper/pve-vm--103--disk--1

Your invocation of dd was using 512 byte blocks, which would result in two system calls reads per KB, or ~2000 per MB. With cat you'll probably get away with one per MB.

  • 1
    OP is using bs as 1M. – heemayl Oct 13 '16 at 22:14
  • Fine, my use of dd was not particularly optimal. Still all these commands, copy all the data from the .raw file, which is 127GB. And the actual data there is 8.8GB. Probably there is a smarter import option not using dd at all. – mist Oct 13 '16 at 22:21
  • Actually there's some indication that pv < file > dev might be somehow be skipping the blank spaces in the .raw because I saw data rates like 1.6GB/sec for more than 4 seconds. Will investigate further – mist Oct 13 '16 at 22:40
  • @heemayl not when I answered the question they weren't. But I see now there's an edit that's added this in. – roaima Oct 13 '16 at 23:05

RAW format supports only preallocation, that's why you got full size disk when you converted by qemu-img.

Try convert vmdk image file to qcow2 format, witch can work without preallocation.


I was migrating from XenServer to Proxmox and I figured out this solution.

First get a qcow2 file if you don't already have it (You may need to use a different command here if your source file is not a raw disk image, the important thing is to get a qcow2 file as result)

qemu-img convert rawimage.img -O qcow2 thinimage.qcow2

Covert the qcow2 image to raw sparse file:

qemu-img convert -p -f qcow2 -O raw -t none -T none thinimage.qcow2 rawsparce.raw

Write the sparse file to the VM's thin lv:

dd if=rawsparce.raw of=/dev/mapper/pve-vm--100--disk--1 bs=8M conv=sparse status=progress

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.