[SOLVED] How to recuperate the VM files after a Proxmox reinstallation

titust11

Member
Nov 18, 2021
48
4
8
65
I had to reinstall Proxmox because for some reason it stopped booting.
The VM files were installed in a dedicated nvme drive mounted on a directory called VM_Repository.
The nvme containing the VMs was not destroyed, just Proxmos was reinstalled. I can see the nvme drive in Disks.
However I am not able to recreate the directory, to remount the ext4 formatted nvme, in order to recuperate my VM files.
I was pretty sure to be able to do this very simple thing in the GUI pve / Directory / Create directory and select the nvme.
Unfortunately the nvme does not show up in there. I'm pretty sure it can be done in the shell, but I'm not an expert. For sure I can dig and find a solution, but preferred the faster method of asking the community.
Thanks
 
Do you got backups of your /etc/pve that was on your system disk? Because without it and the VM/LXC config files in it you won't be able to do much with those virtual disks in that NVMe.

First I would add a line to /etc/fstab to mount the ext4 partition on that NVMe SSD. Then you can go to "Datacenter -> Storage -> Add -> Diectory" to create a directory storage pointing to the mountpoint of the ext4 partition.
 
No backups. For now, for me this is just a practice environment at my home. I'm retired IT guy, Solaris, Windows, sysadmin, worked with Vmware and Hyper-V.
Because without it and the VM/LXC config files in it you won't be able to do much with those virtual disks in that NVMe.
I admit I'm new and learning Proxmox, but if this is not possible, Proxmox is far behind. The config of a VM is just a bunch of parameters, CPU, Memory, Disk, OS, etc... These can be manually recreated as long as you have the intact virtual disks of the VM, right? theoretically. Then why is this not possible in Proxmox? I've done this dozens of time on other virtualization platforms
--------------------
 
Actually I am answering myself to my initial question.
I thought it was possible using the GUI to get back the previous directories / mounts of the drives after a Proxmox reinstallation. But not, it's not possible to use the GUI. Use the shell. The GUI is really rudimentary, it lacks a lot of flexibility and it requires more work in the future Proxmox versions.

Let's assume the name of the drive is VM_Repository
# lsblk -f to determine the UUID of the drive
# nano /etc/systemd/system/mnt-pve-VM_Repository.mount and add the following
Options=defaults
Type=ext4
What=/dev/disk/by-uuid/fd01c3b8-0a7d-462f-b0c1-7e372a974ac1
Where=/mnt/pve/VM_Repository

[Unit]
Description=Mount storage 'VM_Repository' under /mnt/pve

# mkdir mnt/pve/VM_Repository

#nano /etc/pve/storage.cfg and add the following
dir: VM_Repository
path /mnt/pve/VM_Repository
content snippets,images,backup,vztmpl,rootdir,iso
is_mountpoint 1
nodes pve

# systemctl enable /etc/systemd/system/mnt-pve-VM_Repository.mount
# reboot
# cat /proc/mounts check if the drive is mounted
 
Last edited:
But I don't have an answer to the question, how do I get my VMs back when I have the virtual drives?
 
No backups. For now, for me this is just a practice environment at my home. I'm retired IT guy, Solaris, Windows, sysadmin, worked with Vmware and Hyper-V.

I admit I'm new and learning Proxmox, but if this is not possible, Proxmox is far behind. The config of a VM is just a bunch of parameters, CPU, Memory, Disk, OS, etc... These can be manually recreated as long as you have the intact virtual disks of the VM, right? theoretically. Then why is this not possible in Proxmox? I've done this dozens of time on other virtualization platforms
--------------------
You can create new config files if you remeber everything and use it with your old disk images. But if you remembered something wrong the VM won't boot.

- add your old VM storage to PVE (Datacenter -> Storage -> Add)
- create a new VM with the same VMID. Don't add any virtual disks to it.
- run qm rescan. Now the old virtual disks should show up at your VMs hardware tab as a detached disk
- attach the old disk
 
Last edited:
You can create new config files if you remeber everything and use it with your old disk images. But if you remembered something wrong the VM won't boot.

- add your old VM storage to PVE (Datacenter -> Storage -> Add)
- create a new VM with the same VMID. Don't add any virtual disks to it.
- run qm rescan. Now the old virtual disks should show up at your VMs hardware tab as a detached disk
- attach the old disk
Yes Mr. Famous Member, I followed your directions and it worked perfectly. To attach the old disks I had to edit the /etc/pve/qemu-server/<VMID>.conf manually in order to replace the new drives with the unused ones. I found no way to change something in the GUI in Hardware / Hard Disk... (greyed out)
 
Yes Mr. Famous Member, I followed your directions and it worked perfectly. To attach the old disks I had to edit the /etc/pve/qemu-server/<VMID>.conf manually in order to replace the new drives with the unused ones. I found no way to change something in the GUI in Hardware / Hard Disk... (greyed out)
Good to hear that it worked.
VMIDs were identical? The naming scheme of the virtual disk should define which VM they should belong to. Then a qm rescan in CLI should find the old virtual disk and show them as unattched disk at the corresponding VM where it should be possible to attach them using the attach button. If you don't create VMs with the correct VMIDs it's neccessary to rename the old virtual disks to fit the new VMID.
 
  • Like
Reactions: titust11
Would that be an RFE to add the details needed to associate an observed QCOW2 image - save the host-glue somewhere? Reinstalls of Proxmox seem common., I am just starting out, but this would be bad if I had a year of work lost.
 
  • Like
Reactions: cybericius
Would that be an RFE to add the details needed to associate an observed QCOW2 image - save the host-glue somewhere? Reinstalls of Proxmox seem common., I am just starting out, but this would be bad if I had a year of work lost.
Even if there is only a migration tool as a first step that can export the config of an existing Proxmox deployment and import (all or selectable items) to a new one. So +1
 
Because without it and the VM/LXC config files in it you won't be able to do much with those virtual disks in that NVMe.
That is really not a true statement. All you need to do is recreate the datastore, and make a new vmid.conf- it doesnt even matter if you knew that the original settings were; all the important stuff is in the guest os anyway.
Would that be an RFE to add the details needed to associate an observed QCOW2 image
the qcow filename would be in the form of "vm-vmid-disk-n". all you need to do is create a dummy vm with the same vmid as your qcow file and dont assign a disk; once thats done, the unassociated qcow will appear as a drive available to map.
 

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!