Export and convert virtual hard disk from a VM (PVE-Cluster)

d-nnis

Member
Jan 1, 2022
5
0
6
46
Hi Proxmox-community (and authors),

I am trying to export a virtual hard disk of raw-format from a Virtual Machine from a Cluster-organized Proxmox-Setup. The basic problem seems to be that I cannot locate the hdd on this setup, which is a prelimary condition to actually export and convert to the desired format. In my case: vmdk since I need to transfer the VM to a ESXi host.

First approach - As explained above: convert to desired format.
Where/ what is the hdd of the VM?
Bash:
pvesm list vm-hdd --vmid 130020
--> vm-hdd:vm-130020-disk-1 raw images 64424509440 130020

Bash:
qemu-img convert -f raw vm-hdd/vm-130020-disk-1 -O vmdk vm-hdd1.vmdk
--> Could not open 'vm-hdd/vm-130020-disk-1': No such file or directory

Ok so where is it? var/lib/vz does not contain any of the virtual hdds

/etc/pve/qemu-server/130020.conf reveals:
virtio0: vm-hdd:vm-130020-disk-1,cache=writethrough,discard=on,size=60G

Not much news here. Staying behind cluelessly...

Second approach - Extracting hdd from dump/backup/vma.zst
Bash:
zstd -d vzdump-qemu-130020-2022_04_26-12_58_30.vma.zst
Then further process vma-file with vma? This seems to be a PVE-native tool that is not intended to extract the raw-HDD-file...?


Third approach ... ?
Unfortunately I am out of luck with the Proxmox-documentation.

What are other promising ways?
What is the most efficient way?

Thank you for your insights!
 
hi,

/etc/pve/qemu-server/130020.conf reveals:
virtio0: vm-hdd:vm-130020-disk-1,cache=writethrough,discard=on,size=60G
also take a look at your /etc/pve/storage.cfg file to figure out what kind of storage backend is used for vm-hdd.

once you figure that out you can find where it's located.

alternatively you can search your server for it:
Code:
find / -name '*vm-130020-disk-1* 2>/dev/null

hope this helps!
 
  • Like
Reactions: d-nnis
pvesm path vm-hdd:vm-130020-disk-1 should give you a path you can pass to qemu-img (take care that the VM is not running at the same time!)..
 
  • Like
Reactions: d-nnis and oguz
Hi there thanks for the feedback.

The Info from
pvesm path vm-hdd:vm-130020-disk-1
was helpful:
rbd:vm-hdd/vm-130020-disk-1:conf=/etc/pve/ceph.conf:id=admin:keyring=/etc/pve/priv/ceph/vm-hdd.keyring

That led me to the working export/conversion:
qemu-img convert -f raw rbd:vm-hdd/vm-130020-disk-1 -O vmdk vm-hdd1.vmdk

So the protocol indication rbd (RADOS) was missing.
 
it depends a lot on the storage whether the 'path' looks similar to the volid referenced in the config or not ;)