How do you restore VMs from a dead instance of proxmox

toefu

New Member
Dec 4, 2024
5
0
1
My linux skills aren't the best, and i've been searching and trying everything w/ no luck.
I have a hard drive that was previously holding 2 vms on proxmox. Due to stupidity, I killed that instance of proxmox to an unusable state. The VM LV's still exist on there though.

vm-100-disk-0,1,2
vm-101-disk-0,1,2

I have installed proxmox on another machine and plugged the old hard drive. when doing an LVS, it would complain that i had 2 VG's named PVE, so after some searching, i renamed them to lv_old instead of PVE. What i want to do is copy the VM disks to the PVE VG. Based on my search, once I get the images to the PVE group, i should be able to create a VM and point them to the newly copied disks. Is this a valid statement? I've spent quite a few hours trying every combination on online help.

If you look at the lvm-local, you do not see any of these images at all. I've tried making the lv's active, renaming, moving, I must be doing something wrong.
 
Hi,

You probably won't be able to do this using only the GUI. Add the old disk (or rather its volume group, that should be detected by using pvs/vgs/lvs) as a LVM storage on your new setup, See if you can see them by clicking on the "old" storage, in VM Disks already.
 
If it works, you could get lucky and if you have a VM with the same VMID your LV is set to, it might be detected as an Unused disk, that you could attach to the VM. That could work... But it probably won't.

So create a VM with the same spec in the GUI, with a (or many) disks the same size as the one before. Then you can import all data from the old pv to the new one, by using something like:
Code:
dd if=/dev/old/vm-ORIGINAL_VMID-disk-0 of=/dev/pve/vm-NEW_VMID-disk-0
this will copy data from the old LV to the new one.
 
I'll give the dd command a shot when i get home today. i was walking along this path last night. setting up a new vm with identical config, but wasn't sure of the final steps. Thanks
 
There is a qm importdisk command as well, but it probably won't help you in that case, as it wants images, not devices such as LVs. There is room for improvement here on Proxmox though, there could be an option to somehow ease re-attaching disks even from another VM… It would also make cloud images easier to attach to new VMs... but well ;)
 
took a while to copy the data, but was successful. now my problem is trying to figure out my exact vm settings from the previous install of proxmox to get them to line up as it is not booting right now. Tried my best to get the vm settings the same, but just can't recall.

trying to figure out how to mount the old root to file system so i can look inside the etc folder of the old root. Thanks for your help Gilou, I feel i'm pretty close to getting it right.
 
Setup a VM with a live ISO to boot and inspect all disks, and if it's the same OS as your VM, you can even install grub from there.
Say it's Ubuntu, boot it (or boot it live using netboot.xyz for even more fun! ;)), then check what lsblk has to say, then try mounting partitions in /mnt to find your boot / root partitions, and then start setting the boot disks properly, then maybe fix GRUB.. though I'd assume disk 0 was the system for each ;)
 
  • Like
Reactions: Kingneutron
just curious, i tried something numerous times and don't understand it. Why am i not able to simply mount the vg_old/root to a /mnt/old_root folder?

if the new instance of proxmox is debian (as is the older instance), why can't I mount it from shell? I'll try the live iso method, but just trying to understand the logic behind it.

I tried many different ways to mount the old root with no luck at all.
 
Well, technically, it's a LV, yes, but it's not directly a mountable partition, it's a raw device, that has its own partition table and all (unless you used it directly as a filesystem, without a label nor a partition there…). So you *could* mount it, but it's not that simple.
Also, it's probably not too nice that there is something (I haven't checked what, I'm guessing some kind of ID linked to the VM) preventing the disk to be simply shown as unused if you bring back a properly named LV (such as vm-xx-disk-0). But there are good reasons I can imagine not to do that blindly also…
 
Last edited:
  • Like
Reactions: Kingneutron
I spent a couple of hours on this last night with no luck at all. No matter what settings i choose on the VM, after the dd copy, I cannot get it to boot. I'm assuming that my new VM config does not align with the old VM config, and I simply can't guess the right combination.

I also setup a VM that boots off the debian live iso. Looking at lsblk, i only saw sda1 drive and no logical drives inside. Of which mounting in every which way was failing.

I'll likely just start from scratch and try to use my latest copy of the data from the vm's.
 

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!