[SOLVED] Convert LVM to vmdk

cosmos

Well-Known Member
Apr 1, 2013
104
2
58
Hello all,

I've got a VM running on LVM storage. The storage is /dev/vmstorage/vm-102-disk-0. I want to convert this to vmdk for import to an ESXi 7.0U1 host. What/which commands can I use to get this done as fast as possible?

The VM is down, so there is no issue copying storage to vmdk. Searching around I've found a solution involving two steps: first use dd to copy the image to a raw file and then use qemu-img to convert it to vmdk (not sure about the options to use in the latter case).

Is there a single command that can accomplish both steps above?

TIA!
 
Hey cosmos,

did you already tried the following via CLI?:

qemu-img convert -p $INPUTDISK -O $FORMAT -o subformat=streamOptimized $NEWDISK

qemu-img convert -p /dev/vmstorage/vm-102-disk-0 -O vmdk -o subformat=streamOptimized /tmp/ExportedDisk-0.vmdk

-p stands for Progress,
-O specifies the output format
-o is for use of an dynamic allocated image

hope i could help
 
I tried that, it failed with
qemu-img: Could not open '/dev/vmstorage/vm-102-disk-0': Could not open '/dev/vmstorage/vm-102-disk-0': No such file or directory

Any other idea on using qemu-img to convert LVM block storage to vmdk?

EDIT: Strike that out, on another LVM image it works just fine. I'll have to figure out what is wrong here...
 
Last edited:
I still can't figure how I can convert this LVM image. Doing an lvdisplay it shows it alright:
Code:
 --- Logical volume ---
  LV Path                /dev/vmstorage/vm-106-disk-1
  LV Name                vm-106-disk-1
  VG Name                vmstorage
  LV UUID                P3284v-yK3v-GSWf-QbOf-fH5Q-8a8m-FzO2EC
  LV Write Access        read/write
  LV Creation host, time pve-1, 2018-03-06 14:40:42 +0200
  LV Status              available
  # open                 1
  LV Size                20.00 GiB
  Current LE             5120
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3



# ls -laF /dev/vmstorage/vm-106-disk-1
lrwxrwxrwx 1 root root 7 May 26 09:33 /dev/vmstorage/vm-106-disk-1 -> ../dm-3
# ls -laF /dev/dm-3
brw-rw---- 1 root disk 253, 3 May 26 10:18 /dev/dm-3

Ideas?
 
Searching around, it seems that creation of these links are made by udev. I restarted the pve node and the links got recreated alright.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!