Help! Restore VM

junkleybr

New Member
Sep 12, 2024
1
0
1
Hello. A proxmox server had a problem and I lost the disk that was installed on it. However, the disk on which the VM is located is intact. How do I bring the VM to a new Proxmox server without losing the VM on that disk?
 
Welcome to the forum, junkleybr!

Was the Proxmox VE server where the disk failed in a cluster? If so, then the VM configurations are stored distributed on the other nodes and you can recover them from by removing the old node (as described at [1]), setting up a new node (with the VM data disk set up) and then adding it to the cluster again.

If not, do you have any backups of the directory /etc/pve/? Those would be helpful as they contain - next to all other config files - the VM configuration files. If you do not have that either, you'd have to set up PVE on a new disk and do the following:
  1. Set up the existing storage with the VM data (in addition to any other necessary settings) in your new PVE installation.
  2. Depending on your storage's filesystem, you could list all the images that are on the storage (e.g. lvs for LVM thinpool). You should see a list of subvolumes/files with names like vm-100-disk-0, where the first number is the VM id and the second number is the disk number.
  3. Now you need to recreate each VM that you had before. If you're creating them from the WebGUI, make sure that you do not use any ISO media and do not create any disks (you can remove the default disk when clicking on the trash icon next to it).
  4. After recreating all old VMs, run qm rescan in the node's shell, which should automatically detect the storages as "unused" disks.
  5. If you click on one of them, you can add them back as disk drives.
Make sure that the reconnected disks are in the right order and if you have UEFI and/or TPM set up, be sure to set the efidisk (usually, it's disk number 0) and the tpmstate correctly (This might need manual intervention with qm set or editing the vm config by hand).

Also be aware that Windows VMs are quite sensitive to changes in the config file and that they need to be setup with UEFI and probably also a TPM state file for Windows Server 2022/Windows 11.

I hope that you can recover from your lost PVE installation and I would advise you to either regularly backup the /etc/pve directory and/or setup the PVE with some data redundancy (e.g. ZFS) to prevent data loss from happening again.

[1] https://pve.proxmox.com/pve-docs/chapter-pvecm.html#_remove_a_cluster_node
 
  • Like
Reactions: UdoB

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!