How to restore a VM?

Eschen

New Member
Aug 27, 2023
5
0
1
I am an idiot.
I upgraded my PVE to 7.4 today, but it cannot start after the upgrade is completed. I tried searching for a long time but couldn't solve it. So I found a USB drive and installed the new PVE on it. Name the old PVE pve-OLD-134EEXXX during installation.
Now, I can add drives from my old install as LVM's That has data on them but cannot access it
Now I want to import my VM into the new PVE because there is a lot of important data in the virtual machine. What should I do?
The following are the commands I saw while searching, hoping to be helpful.
Bash:
root@pvej:~# lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                           8:0    0 111.8G  0 disk
├─sda1                        8:1    0  1007K  0 part
├─sda2                        8:2    0   512M  0 part
└─sda3                        8:3    0 111.3G  0 part
  ├─pve--OLD--134EE27A-swap 253:0    0     8G  0 lvm
  └─pve--OLD--134EE27A-root 253:1    0 103.3G  0 lvm
sdb                           8:16   0 931.5G  0 disk
sdc                           8:32   1  57.3G  0 disk
├─sdc1                        8:33   1  1007K  0 part
├─sdc2                        8:34   1   512M  0 part /boot/efi
└─sdc3                        8:35   1  56.8G  0 part
  ├─pve-swap                253:2    0     7G  0 lvm  [SWAP]
  └─pve-root                253:3    0  49.8G  0 lvm  /
root@pvej:~# vgscan
  Found volume group "pve" using metadata type lvm2
  Found volume group "pve-OLD-134EE27A" using metadata type lvm2
root@pvej:~# lvscan
  ACTIVE            '/dev/pve/swap' [7.00 GiB] inherit
  ACTIVE            '/dev/pve/root' [49.79 GiB] inherit
  ACTIVE            '/dev/pve-OLD-134EE27A/swap' [8.00 GiB] inherit
  ACTIVE            '/dev/pve-OLD-134EE27A/root' [<103.29 GiB] inherit


update:

I mount pve-OLD-134EE27A, it seems to found the disk of the VM .
Bash:
root@pvej:/mnt/pve_old/var/lib/vz/images# ls
100  101  102  103
root@pvej:/mnt/pve_old/var/lib/vz/images# cd /mnt/pve_old/var/lib/vz/images/100
root@pvej:/mnt/pve_old/var/lib/vz/images/100# ls
vm-100-disk-0.qcow2
root@pvej:/mnt/pve_old/var/lib/vz/images/100# ls -l
total 325944
-rw-r----- 1 root root 4295884800 Aug 27 22:07 vm-100-disk-0.qcow2
root@pvej:/mnt/pve_old/var/lib/vz/images/100# cd /mnt/pve_old/var/lib/vz/images/101
root@pvej:/mnt/pve_old/var/lib/vz/images/101# ls
vm-101-disk-0.qcow2
root@pvej:/mnt/pve_old/var/lib/vz/images/101# ls -ll
total 2151184
-rw-r----- 1 root root 10739318784 Aug 27 22:07 vm-101-disk-0.qcow2
root@pvej:/mnt/pve_old/var/lib/vz/images/101# cd /mnt/pve_old/var/lib/vz/images/102
root@pvej:/mnt/pve_old/var/lib/vz/images/102# ls
vm-102-disk-0.raw
root@pvej:/mnt/pve_old/var/lib/vz/images/102# cd /mnt/pve_old/var/lib/vz/images/103
root@pvej:/mnt/pve_old/var/lib/vz/images/103# ls
vm-103-disk-0.raw
root@pvej:/mnt/pve_old/var/lib/vz/images/103# Remote closed!

but I can't find the configuration file of the VM, can anyone help me?

Bash:
root@pvej:~# find /mnt/pve_old/ -name 100.conf
root@pvej:~# locate 100.conf
-bash: locate: command not found
root@pvej:~# find /mnt/pve_old -name 100.conf
root@pvej:~# find /mnt/pve_old -name 100
/mnt/pve_old/var/lib/rrdcached/db/pve2-vm/100
/mnt/pve_old/var/lib/vz/images/100
root@pvej:~# find /mnt/pve_old -name qemu-server
/mnt/pve_old/var/lib/qemu-server
/mnt/pve_old/usr/lib/qemu-server
/mnt/pve_old/usr/share/doc/qemu-server
/mnt/pve_old/usr/share/qemu-server
 
Last edited:
The conf files of the VMs and containers are saved here: /etc/pve/nodes/<NODE-Name>/qemu-server and /etc/pve/nodes/<NODE-Name>/lxc
If you still have access to the old PVE installation, you should find it there.
 
The conf files of the VMs and containers are saved here: /etc/pve/nodes/<NODE-Name>/qemu-server and /etc/pve/nodes/<NODE-Name>/lxc
If you still have access to the old PVE installation, you should find it there.
Thank you for your reply, I'm going to restore my VM, so I need to find the VM configuration file stored in the old hard disk.
Bash:
root@pvej:~# cd /mnt/pve_old/etc/pve
root@pvej:/mnt/pve_old/etc/pve# ls
root@pvej:/mnt/pve_old/etc/pve# ls-l
-bash: ls-l: command not found
root@pvej:/mnt/pve_old/etc/pve# ls -l
total 0
root@pvej:/mnt/pve_old/etc/pve#
As you can see, there are no files in the /mnt/pve_old/etc/pve directory.
 
Yeah I forgot /etc/pve is a fuse mount of a sqlite db here: /var/lib/pve-cluster/config.db
If this file still exist I guess there is a way to extract those conf files. But no clue.
 
Yeah I forgot /etc/pve is a fuse mount of a sqlite db here: /var/lib/pve-cluster/config.db
If this file still exist I guess there is a way to extract those conf files. But no clue.
I've found this file, but I'm having trouble starting the service after replacing
Bash:
root@pvej:~# service pve-cluster stop
root@pvej:~# cp /mnt/pve_old//var/lib/pve-cluster/config.db /var/lib/pve-cluster/config.db
root@pvej:~# cp -r /mnt/pve_old/var/lib/vz/images/100/ /var/lib/vz/images/100
root@pvej:~# cp -r /mnt/pve_old/var/lib/vz/images/101/ /var/lib/vz/images/101
root@pvej:~# cp -r /mnt/pve_old/var/lib/vz/images/102/ /var/lib/vz/images/102
root@pvej:~# cd /var/lib/pve-cluster/
root@pvej:/var/lib/pve-cluster# ls -l
total 4096
-rw------- 1 root root   36864 Aug 28 22:09 config.db
-rw------- 1 root root   32768 Aug 28 22:06 config.db-shm
-rw------- 1 root root 4120032 Aug 28 22:06 config.db-wal
root@pvej:/var/lib/pve-cluster# chmod 0600 config.db
root@pvej:/var/lib/pve-cluster# ls -l
total 4096
-rw------- 1 root root   36864 Aug 28 22:09 config.db
-rw------- 1 root root   32768 Aug 28 22:06 config.db-shm
-rw------- 1 root root 4120032 Aug 28 22:06 config.db-wal
root@pvej:/var/lib/pve-cluster# service pve-cluster start
Job for pve-cluster.service failed because the control process exited with error code.
See "systemctl status pve-cluster.service" and "journalctl -xeu pve-cluster.service" for details.
root@pvej:/var/lib/pve-cluster# systemctl status pve-cluster.service
× pve-cluster.service - The Proxmox VE cluster filesystem
     Loaded: loaded (/lib/systemd/system/pve-cluster.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Mon 2023-08-28 22:21:49 CST; 23s ago
   Duration: 19h 20min 36.752s
    Process: 68399 ExecStart=/usr/bin/pmxcfs (code=exited, status=255/EXCEPTION)
        CPU: 16ms

Aug 28 22:21:49 pvej systemd[1]: pve-cluster.service: Scheduled restart job, restart counter is at 5.
Aug 28 22:21:49 pvej systemd[1]: Stopped pve-cluster.service - The Proxmox VE cluster filesystem.
Aug 28 22:21:49 pvej systemd[1]: pve-cluster.service: Start request repeated too quickly.
Aug 28 22:21:49 pvej systemd[1]: pve-cluster.service: Failed with result 'exit-code'.
Aug 28 22:21:49 pvej systemd[1]: Failed to start pve-cluster.service - The Proxmox VE cluster filesystem.
root@pvej:/var/lib/pve-cluster# systemctl stop corosync
root@pvej:/var/lib/pve-cluster# chmod 0600 config.db
root@pvej:/var/lib/pve-cluster# systemctl status pve-cluster.service
× pve-cluster.service - The Proxmox VE cluster filesystem
     Loaded: loaded (/lib/systemd/system/pve-cluster.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Mon 2023-08-28 22:21:49 CST; 2min 26s ago
   Duration: 19h 20min 36.752s
    Process: 68399 ExecStart=/usr/bin/pmxcfs (code=exited, status=255/EXCEPTION)
        CPU: 16ms

Aug 28 22:21:49 pvej systemd[1]: pve-cluster.service: Scheduled restart job, restart counter is at 5.
Aug 28 22:21:49 pvej systemd[1]: Stopped pve-cluster.service - The Proxmox VE cluster filesystem.
Aug 28 22:21:49 pvej systemd[1]: pve-cluster.service: Start request repeated too quickly.
Aug 28 22:21:49 pvej systemd[1]: pve-cluster.service: Failed with result 'exit-code'.
Aug 28 22:21:49 pvej systemd[1]: Failed to start pve-cluster.service - The Proxmox VE cluster filesystem.
root@pvej:/var/lib/pve-cluster#
 
You only copied the db file, not the "-shm" and "-wal" files from the same dir, right?
Can you try to copy them too and restart the service again?
Edit: Or move both files to a different location.
 
Last edited:
You only copied the db file, not the "-shm" and "-wal" files from the same dir, right?
Can you try to copy them too and restart the service again?
Edit: Or move both files to a different location.
Yes, after copying the 3 files as you said, the service can be started normally, but I found that PVE has crashed again, and I plan to reinstall it
 

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!