Restore VMs after Proxmox system disk died

zuliasro

Member
Dec 25, 2017
25
0
21
74
I have some trouble with a Proxmox machine, the system disk has died, I lost all configuration files. (I know it's a big mistake from my side, from now I do a backup)
The server contains 5 disks, 1 for the system 4 for the virtual machines. The 4 disks used one-by-one as a logical volume group, 1 disk = 1 physical volume = 1 volume group = logical volumes aka VMs.
After I changed the system disk and reinstalled the Proxmox, I have no idea how to attach ready made VM's disks to a new virtual machine.
There are only Windows VMs, no containers.
- Pvdisplay, vgdisplay, lvdisplay show the correct data.
- I tried to use kpartx for mount/check the partitions with SUCCESS, all data show correctly.
- I tried to add storage over the web interface (Datacenter --> Storage --> Add --> LVM --> ...all volume group selectable, exists)
My problem starting here:
After I added a volume group as storage, it does not recognize the VM's disks,
1, Summary --> Usage 100% (this is correct)
2, VM Disks --> EMPTY (this is not correct, there are more disks, lsblk also show the disks, vgscan --> all found, lvscan --> all active)

Please point me to the right way, how to possible add the disks into Proxmox.

Thank you!
 
I don't understand what you want to restore.
If your disk died, your vm-storage died with that disk too...

Or you have a separate disk with the qcow2 or raw hdd volumes of the vms? Which is working?

To restore the config file of the vm is not hard, but you can't restore the storage ...
 
I don't understand what you want to restore.
If your disk died, your vm-storage died with that disk too...

Or you have a separate disk with the qcow2 or raw hdd volumes of the vms? Which is working?

To restore the config file of the vm is not hard, but you can't restore the storage ...
Thanks for your answer.

My server contains 5 physical disks, 1 for the system (Proxmox) and 4 LVM for VM's.
The system disk (/dev/sda) replaced, newly installed, the 4 LVMs left.
Now I have a working Proxmox with RAW VM's disks on logical volumes.
 
i understood now.

do you have any way, to get somehow the content of /etc/lvm/ out of your died drive?
with something like partedmagic etc?
 
Okay, whats the exact output of pvscan and lvs?

OMG, i didn't readed your post correctly, you have your data and you have imported the volumes already.
The only problem is that you can't import the disks of the vms?
 
Last edited:
root@server7:~# pvscan
PV /dev/sdg1 VG lvm05 lvm2 [74.49 GiB / 69.49 GiB free]
PV /dev/sdf VG fourth lvm2 [<223.54 GiB / 0 free]
PV /dev/sde VG third lvm2 [<223.54 GiB / 0 free]
PV /dev/sdd VG second lvm2 [<223.54 GiB / 0 free]
PV /dev/sdc VG first lvm2 [<223.54 GiB / 0 free]
PV /dev/sda3 VG pve lvm2 [73.99 GiB / 9.12 GiB free]
Total: 6 [<1.02 TiB] / in use: 6 [<1.02 TiB] / in no VG: 0 [0 ]

root@server7:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
first first twi-aotz-- <223.32g 47.86 32.17
vm-7011-disk-0 first Vwi-a-tz-- 100.00g first 53.77
vm-7112-disk-0 first Vwi-a-tz-- 40.00g first 42.74
vm-7113-disk-0 first Vwi-a-tz-- 40.00g first 42.78
vm-7114-disk-0 first Vwi-a-tz-- 40.00g first 47.23
fourth fourth twi-aotz-- <223.32g 39.43 28.23
vm-7041-disk-0 fourth Vwi-a-tz-- 100.00g fourth 29.98
vm-7100-disk-0 fourth Vwi-a-tz-- 120.00g fourth 2.92
vm-7142-disk-0 fourth Vwi-a-tz-- 40.00g fourth 45.10
vm-7143-disk-0 fourth Vwi-a-tz-- 40.00g fourth 48.23
vm-7144-disk-0 fourth Vwi-a-tz-- 40.00g fourth 43.10
vm-7142-disk-0 lvm05 -wi------- 5.00g
data pve twi-aotz-- <36.62g 0.00 1.59
root pve -wi-ao---- 18.25g
swap pve -wi-ao---- 8.00g
vm-7141-disk-0 pve Vwi-a-tz-- 8.00g data 0.00
second second twi-aotz-- <223.32g 39.57 28.31
vm-7021-disk-0 second Vwi-a-tz-- 100.00g second 34.59
vm-7122-disk-0 second Vwi-a-tz-- 40.00g second 43.74
vm-7123-disk-0 second Vwi-a-tz-- 40.00g second 42.14
vm-7124-disk-0 second Vwi-a-tz-- 40.00g second 48.57
third third twi-aotz-- <223.32g 40.23 28.41
vm-7031-disk-0 third Vwi-a-tz-- 100.00g third 31.11
vm-7132-disk-0 third Vwi-a-tz-- 40.00g third 55.99
vm-7133-disk-0 third Vwi-a-tz-- 40.00g third 50.78
vm-7134-disk-0 third Vwi-a-tz-- 40.00g third 40.06
 
root@server7:~# cat /etc/pve/storage.cfg
dir: local
path /var/lib/vz
content backup,iso,vztmpl

lvmthin: local-lvm
thinpool data
vgname pve
content images,rootdir

lvm: lvm05
vgname lvm05
content images,rootdir
shared 0

lvm: lvm04
vgname fourth
content images,rootdir
shared 0
 
Means this VM's should work then:
Code:
vm-7041-disk-0 fourth Vwi-a-tz-- 100.00g fourth 29.98
vm-7100-disk-0 fourth Vwi-a-tz-- 120.00g fourth 2.92
vm-7142-disk-0 fourth Vwi-a-tz-- 40.00g fourth 45.10
vm-7143-disk-0 fourth Vwi-a-tz-- 40.00g fourth 48.23
vm-7144-disk-0 fourth Vwi-a-tz-- 40.00g fourth 43.10
7041, 7100, 7142, 7143, 7144

They should have (example):
/etc/pve/qemu-server/7041.conf
virtio0: lvm04:vm-7041-disk-0,cache=writeback,discard=on,size=100G

Correct?
 
Exactly.
But unfortunately VM disks don't show anything in lvm04, simple empty.

Screenshot_9.jpg
 
Last edited:
root@server7:~# pvesm scan lvm04
ERROR: unknown command 'pvesm scan lvm04'
USAGE: pvesm <COMMAND> [ARGS] [OPTIONS]

pvesm scan cifs <server> [OPTIONS]
pvesm scan glusterfs <server>
pvesm scan iscsi <portal>
pvesm scan lvm
pvesm scan lvmthin <vg>
pvesm scan nfs <server>
pvesm scan zfs

pvesm add <type> <storage> [OPTIONS]
pvesm remove <storage>
pvesm set <storage> [OPTIONS]

pvesm alloc <storage> <vmid> <filename> <size> [OPTIONS]
pvesm free <volume> [OPTIONS]
pvesm list <storage> [OPTIONS]

pvesm status [OPTIONS]

pvesm apiinfo
pvesm export <volume> <format> <filename> [OPTIONS]
pvesm extractconfig <volume>
pvesm import <volume> <format> <filename> [OPTIONS]
pvesm path <volume>
pvesm prune-backups <storage> [OPTIONS]

pvesm help [<extra-args>] [OPTIONS]
root@server7:~# pvesm scan lvm
lvm05
pve
first
fourth
third
second
 
root@server7:~# lvchange --addtag @pve-vm-7041 /dev/fourth/vm-7041-disk-0
Logical volume fourth/vm-7041-disk-0 changed.

Nothings changed in GUI.
 
If that doesn't work, then the last idea that i have is:
pvesm import lvm04:vm-7041-disk-0

I don't know where exactly pve stores that data, but it looks good anyway for you, just someone with more clue needs to help out xD
 
root@server7:~# pvesm import lvm04:vm-7041-disk-0
400 not enough arguments
pvesm import <volume> <format> <filename> [OPTIONS]
 

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!