Help recreating deleted VMs and LXCs

digipen79

New Member
Jan 30, 2025
11
2
3
I followed the advice of this user and ran the script they had, which removed my cluster but also all my VMs and LXCs. I have the virtual disks of all the VMs, possibly the ones from the LXCs but haven't determined that yet. I am performing a backup of the disk to an empty disk right now, but is there any way for me to restore the VMs and LXCs that have been deleted?
 
Hi @digipen79 .

Unless you have backup of the configuration file, or find a copy of the config file, the recovery will involve creating a new VM/CT and then adding existing disks to that configuration.
This thread should give you a starting point: https://forum.proxmox.com/threads/new-proxmox-9-1-installation-not-seeing-vms-on-separate-ssd.176375

However, the details and specific steps will depend on your storage configuration. CT recovery is slightly more complicated that VMs due to the filesystem/image layering.

So in short: create new VM/CT , assign the old disk to it, reconstruct any custom configuration (ie passthrough, etc).

I highly recommend that you do a couple of test runs for both VMs and CTs prior to touching any valuable data.

Good luck



Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
  • Like
Reactions: news
Thank you for answering so quickly! Unfortunately I don't remember which VM was which, anything I can do in this instance?
 
It was a cluster, right? Did you do that on all nodes? If not: start one of the other nodes and use "pmxcfs" local mount to access /etc/pve/nodes/abc/xyz. Remember: cluster configuration is shared between all nodes --> it is/was available on all of them, locally.

Disclaimer: not tested...
 
It was a cluster, right? Did you do that on all nodes? If not: start one of the other nodes and use "pmxcfs" local mount to access /etc/pve/nodes/abc/xyz. Remember: cluster configuration is shared between all nodes --> it is/was available on all of them, locally.

Disclaimer: not tested...
I do still have the disk that was the first node, unchanged, so I will do this first thing after work, thank you!
 
OK, got my original node back online, pmxcfs fails with

Code:
root@r630:~# pmxcfs
[main] notice: resolved node name 'r630' to '192.168.10.27' for default node IP address
[main] notice: unable to acquire pmxcfs lock - trying again
[main] crit: unable to acquire pmxcfs lock: Resource temporarily unavailable
[main] notice: exit proxmox configuration filesystem (-1)

As far as pvesm list storage, that also fails with

Code:
root@r630:~# pvesm list storage
storage 'storage' does not exist
 
I was able to get the /etc/pve/nodes directory downloaded from the old node to my main computer, just need to get it uploaded to the new node and I think I might be home free?
 
I FIXED IT!!! I had to stop the new node from trying to cluster with systemctl stop pve-cluster then /usr/bin/pmxcfs -l, after this I was able to create the nodes directory and pscp the files from my Windows machine to the new server. After that I just reloaded the Web GUI and everything is back! Only issue now is that most VMs/LXCs do not start up properly, giving me "Starting VM 125 failed: activating LV 'pve/vm-125-disk-1' failed: Cannot activate LVs in VG pve while PVs appear on duplicate devices."
 
  • Like
Reactions: UdoB
I had copied the disk from sda to sdb, took out sdb and now the VMs/LXCs start up just fine, still need to run the systemctl stop pve-cluster then /usr/bin/pmxcfs -l commands to be able to connect to the server though