Import VMs/Containers from previous Proxmox install

Rowe

Active Member
Sep 14, 2019
16
0
41
Hello.

I have reinstalled Proxmox because I have changed my motherboard.
In my rush, I did however forget to backup my VMs and containers. Stupid me.

I am using ZFS raidz1 on two ssd disks, which I have successfully mounted.
My question then is; is it possible to import the VMs and containers lying on the zfs volume?
I have tried this
Code:
qm importdisk 202 /dev/pool1-4tb/pool1-4tb_encrypted/vm-202-disk-0 encrypted-4tb
found from the wiki.
I am however told that the file is a "non-existent or non-regular file".

Thinking that it might be because I have to create the VM in PVE first, I ran
Code:
qm create 202 -name vm202 -memory 1024 -bootdisk sata0
and then the "importdisk" command from above.
This didn't change anything.

Am I doing something wrong?


Edit:
For anyone who is as stupid as me. This is what I did.

I started by importing the pools, so that I later could add them so that Proxmox could also see them.
Code:
zpool import -f [poolname]
The "-f" is needed since the pool was last used on another system. Otherwise zfs will not import the pool. Only give a warning.

After that I added the pools to Proxmox.
Code:
pvesm add zfspool [name-seen-in-proxmox] -pool [zfs-pool-name]

Then I had to recreate the config files for each VM and container. This has to be done from memory if you don't have any old backups.
When that was done, I had successfully restored all of my VMs & containers.

Thank you so much @Dunuin
 
Last edited:
You zvols and datasets containing the virtual disks of that VMs/LXCs should still exist on your SSDs. But what you lost are your VMs/LXCs config files (these were in your /etc/pve/lxc and /etc/pve/qemu-server).
So you would need to create new config files from your memory with the same setting used with the old VMs. Then you point the config files to use your old zvols/datasets.

You really should always keep backups of your VMs, not just if you plan to reinstall PVE...

If you got some old VM backups, these would contain the config files too. So you could use the config files from your old backups and the virtual disks from your pool.
 
Last edited:
Unfortunately I don't have an old backup either. I have deleted them since, because I overwrote the disk they were on.
But yes, I agree. Always keep backups. It just took me some time to realize :(

I will have to see if I can get it running by editing some config files.
Thanks
 
You zvols and datasets containing the virtual disks of that VMs/LXCs should still exist on your SSDs. But what you lost are your VMs/LXCs config files (these were in your /etc/pve/lxc and /etc/pve/qemu-server).
So you would need to create new config files from your memory with the same setting used with the old VMs. Then you point the config files to use your old zvols/datasets.

You really should always keep backups of your VMs, not just if you plan to reinstall PVE...

If you got some old VM backups, these would contain the config files too. So you could use the config files from your old backups and the virtual disks from your pool.
I have now done as you recommended, and went ahead and created all the config files from scratch. This proved to work exceptionally well.
I do however have one question regarding this.
When I create a vm from the UI, the config file has a line called smbios1" containing a UUID. I have not included that in the config files I created myself, but it seems to work anyways.
Is that something I will have to fix, or will it just work without it?

Other than that. Thank you so much for saving my ass!
 

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!