[SOLVED] Recovering VMs from HDD from failed server

albert81

New Member
Nov 4, 2023
3
1
3
Hi, I have two servers (different hardware) with proxmox standalone installations (no cluster) and one of them broke due to power issues. I need to recover a VM from that HDD and mounting it on the remaining server. This is what I did:
- Attached the HDD to the server, but when booting I had a duplicate VG name error (both disks had the same) so I googled for it and fortunately the server finished booting after the warning, so this is what I did to rename the added HDD VG Name:
1 - "vgdisplay" to see the details, specifically the UUIDs
2 - used the vgrename command specifying the UUID from the new attached HDD and the new name.
3 - "vgdisplay" again to check the changes, everything was ok and then restarted the server, this time it booted up with no error.

At some point I read about adding that disk as an LVM storage (with disk image and content), I did it but when I select that new storage, it shows no VM or CT on it.

Then tryied mounting the partition were the data is (/dev/sdb3) to a folder in /mnt directory but I get an error that it can´t be done. So did some more search and found how to mount an LVM volume with the commands "vgscan" and then "vgchange [path to the lvm volume] -ay" Then with lvdisplay I can see all the logical volumes.

And that´s it, don´t know what to do next, all the answers I've found so far doesn't include this scenario. I'd appreciate any help. Thanks
 
I am not very familiar with lvm but probably the most straight forward way would be to create a VM with the same ID from the crashed server.
Then you can rescan for any existing VM disks as they all have the same naming convention - e.g. vm-114-disk-0
After that you have the old disk added as an unattached disk to your VM and can try to start the VM.
 
Hi Albert,

Welcome to the forums!

Attached the HDD to the server
For the rest of the story it does not matter so much, but I wondered which HDD and which server, recalling that you already had HDD and server connected to begin with.

This is what I understood from your plight:
  • A server (A) crashed thoroughly enough not to boot anymore from its own boot/root partition;
  • Storage disks (A) are fine
  • The storage disk(s)(A) are taken out and connected to another machine (B) that does boot;
  • On boot, "B" complains about duplicate volume groups
    • this problem is resolved through vgrename ; I'll call the new volume group lvmA
  • Mounting of volumes on lvma is not possible, the volume is inactive
    • this is resolved through vgchange -ay lvmA
    • now it is possible to mount /dev/mapper/lvmA-vm101, etc
  • Proxmox does see storage with a familiar name, but does not show the expected contents of this storage
Did I follow your story?
that´s it, don´t know what to do next,
My next steps would be:
  • check output of lsblk (for overview of all block devices)
  • check output of lvs (for logical volume info); eg, your vg lvmA and lv vm101 should show up
  • match with contents of /etc/pve/storage.conf (to see whether the actual backend to a storage label matches the storage you expect to find there); possibly the configuration has a storage with a name that is familiar to you, but which points to the wrong volume group (since you renamed it)
Your specific scenario may be new, but the actual problem you face now is the same as "How do I activate a VM on an existing disk to another (new or existing) Proxmox?".

I hardly ever use VM's, but maybe you could try:
  • create a new VM, with a dummy storage you have available
  • check the created configuration for the new VM in /etc/pve/qemu-server/vmid.conf
  • replace the configured storage with your own storage; in my example, that would be :
    • scsi0: lvmA:vm101,discard=on,iothread=1,size=250G , but of course, use your own 'lost' volume details
Good luck!
 
Hi Albert,

Welcome to the forums!


For the rest of the story it does not matter so much, but I wondered which HDD and which server, recalling that you already had HDD and server connected to begin with.

This is what I understood from your plight:
  • A server (A) crashed thoroughly enough not to boot anymore from its own boot/root partition;
  • Storage disks (A) are fine
  • The storage disk(s)(A) are taken out and connected to another machine (B) that does boot;
  • On boot, "B" complains about duplicate volume groups
    • this problem is resolved through vgrename ; I'll call the new volume group lvmA
  • Mounting of volumes on lvma is not possible, the volume is inactive
    • this is resolved through vgchange -ay lvmA
    • now it is possible to mount /dev/mapper/lvmA-vm101, etc
  • Proxmox does see storage with a familiar name, but does not show the expected contents of this storage
Did I follow your story?

My next steps would be:
  • check output of lsblk (for overview of all block devices)
  • check output of lvs (for logical volume info); eg, your vg lvmA and lv vm101 should show up
  • match with contents of /etc/pve/storage.conf (to see whether the actual backend to a storage label matches the storage you expect to find there); possibly the configuration has a storage with a name that is familiar to you, but which points to the wrong volume group (since you renamed it)
Your specific scenario may be new, but the actual problem you face now is the same as "How do I activate a VM on an existing disk to another (new or existing) Proxmox?".

I hardly ever use VM's, but maybe you could try:
  • create a new VM, with a dummy storage you have available
  • check the created configuration for the new VM in /etc/pve/qemu-server/vmid.conf
  • replace the configured storage with your own storage; in my example, that would be :
    • scsi0: lvmA:vm101,discard=on,iothread=1,size=250G , but of course, use your own 'lost' volume details
Good luck!
Hi and thanks for your reply, yes you got it correctly, I'll go through your recomendations and kepp posting if needed, thanks again
 
Problem solved, thanks for the help, this helped me as a guide to get it right
I am not very familiar with lvm but probably the most straight forward way would be to create a VM with the same ID from the crashed server.
Then you can rescan for any existing VM disks as they all have the same naming convention - e.g. vm-114-disk-0
After that you have the old disk added as an unattached disk to your VM and can try to start the VM.
 
  • Like
Reactions: showiproute