Recover container from a non-booting server disk

hmmatos

Renowned Member
Sep 8, 2015
11
1
68
Hi all,

I have a small proxmox server at home and for some reason it fails to boot.
I removed the SSD and put it in a PC with Ubuntu via USB

I did this to activate the volume

Code:
sudo vgscan
sudo vgchange -ay pve

And now I have this


Code:
sudo lvdisplay

--- Logical volume ---
LV Name                data
VG Name                pve
LV UUID                884sGl-ORLy-pm01-b5qc-0hGP-1YQA-pkiwwa
LV Write Access        read/write (activated read only)
LV Creation host, time proxmox, 2024-06-23 14:19:33 +0100
LV Pool metadata       data_tmeta
LV Pool data           data_tdata
LV Status              available
# open                 0
LV Size                <49.34 GiB
Allocated pool data    12.58%
Allocated metadata     1.79%
Current LE             12631
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           252:6

--- Logical volume ---
LV Path                /dev/pve/swap
LV Name                swap
VG Name                pve
LV UUID                rZv8ID-6n0a-AYKx-gLJT-C8YW-uqsL-6DculZ
LV Write Access        read/write
LV Creation host, time proxmox, 2024-06-23 14:19:30 +0100
LV Status              available
# open                 0
LV Size                8.00 GiB
Current LE             2048
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           252:1

--- Logical volume ---
LV Path                /dev/pve/root
LV Name                root
VG Name                pve
LV UUID                eZfxCd-Cwza-e1yG-T36E-aSyY-EU1h-gESMFp
LV Write Access        read/write
LV Creation host, time proxmox, 2024-06-23 14:19:30 +0100
LV Status              available
# open                 0
LV Size                <37.70 GiB
Current LE             9650
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           252:2

--- Logical volume ---
LV Path                /dev/pve/vm-100-disk-0
LV Name                vm-100-disk-0
VG Name                pve
LV UUID                mNh9Rw-7bc3-UH7N-NzmV-cuBr-vutP-g5z01B
LV Write Access        read/write
LV Creation host, time tortuga, 2024-06-23 14:30:49 +0100
LV Pool name           data
LV Status              available
# open                 0
LV Size                30.00 GiB
Mapped size            8.83%
Current LE             7680
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           252:7

Code:
ls -la /dev/pve/
total 0
drwxr-xr-x  2 root root  140 Sep 24 09:04 .
drwxr-xr-x 21 root root 4720 Sep 24 09:04 ..
lrwxrwxrwx  1 root root    7 Sep 24 09:04 root -> ../dm-2
lrwxrwxrwx  1 root root    7 Sep 24 09:04 swap -> ../dm-1
lrwxrwxrwx  1 root root    7 Sep 24 09:04 vm-100-disk-0 -> ../dm-7
lrwxrwxrwx  1 root root    7 Sep 24 09:04 vm-101-disk-0 -> ../dm-9
lrwxrwxrwx  1 root root    7 Sep 24 09:04 vm-102-disk-0 -> ../dm-8

I have installed a new proxmox server in a new ssd and I need to recover the container, vm-100-disk-0, to this new server.
It is possible, how can I do this?

Thank you so much.
 
You need just to recover the conf files here onto your new from your old pve, eg:
l /etc/pve/lxc/
-rw-r----- 1 root www-data 715 Sep 2 14:15 102.conf
-rw-r----- 1 root www-data 345 Sep 2 14:15 105.conf
-rw-r----- 1 root www-data 346 Sep 2 14:15 106.conf
-rw-r----- 1 root www-data 423 Sep 22 13:21 114.conf
-rw-r----- 1 root www-data 373 Sep 6 10:51 115.conf
-rw-r----- 1 root www-data 360 Sep 20 10:24 120.conf
-rw-r----- 1 root www-data 440 Sep 20 10:24 124.conf
-rw-r----- 1 root www-data 424 Sep 20 10:24 127.conf
-rw-r----- 1 root www-data 680 Sep 20 10:24 147.conf

l /etc/pve/qemu-server/
-rw-r----- 1 root www-data 459 Sep 2 14:21 111.conf
-rw-r----- 1 root www-data 2239 Sep 20 10:24 112.conf
-rw-r----- 1 root www-data 560 Sep 20 10:24 130.conf
 
You need just to recover the conf files here onto your new from your old pve, eg:
l /etc/pve/lxc/
-rw-r----- 1 root www-data 715 Sep 2 14:15 102.conf
-rw-r----- 1 root www-data 345 Sep 2 14:15 105.conf
-rw-r----- 1 root www-data 346 Sep 2 14:15 106.conf
-rw-r----- 1 root www-data 423 Sep 22 13:21 114.conf
-rw-r----- 1 root www-data 373 Sep 6 10:51 115.conf
-rw-r----- 1 root www-data 360 Sep 20 10:24 120.conf
-rw-r----- 1 root www-data 440 Sep 20 10:24 124.conf
-rw-r----- 1 root www-data 424 Sep 20 10:24 127.conf
-rw-r----- 1 root www-data 680 Sep 20 10:24 147.conf

l /etc/pve/qemu-server/
-rw-r----- 1 root www-data 459 Sep 2 14:21 111.conf
-rw-r----- 1 root www-data 2239 Sep 20 10:24 112.conf
-rw-r----- 1 root www-data 560 Sep 20 10:24 130.conf
Hi @waltar,

I have mounted the root volume to try to find does configs but the directories are empty

Code:
ls -la /mnt/pve/root/
total 84
drwxr-xr-x 18 root root  4096 Jun 23 14:21 .
drwxr-xr-x  4 root root  4096 Sep 24 11:52 ..
lrwxrwxrwx  1 root root     7 Apr 24 12:26 bin -> usr/bin
drwxr-xr-x  5 root root  4096 Sep  1 21:47 boot
drwxr-xr-x  4 root root  4096 Apr 24 12:26 dev
drwxr-xr-x 91 root root  4096 Sep  1 21:47 etc
drwxr-xr-x  2 root root  4096 Jan 28  2024 home
lrwxrwxrwx  1 root root     7 Apr 24 12:26 lib -> usr/lib
lrwxrwxrwx  1 root root     9 Apr 24 12:26 lib64 -> usr/lib64
drwx------  2 root root 16384 Jun 23 14:19 lost+found
drwxr-xr-x  2 root root  4096 Apr 24 12:26 media
drwxr-xr-x  3 root root  4096 Jun 23 14:35 mnt
drwxr-xr-x  2 root root  4096 Apr 24 12:26 opt
drwxr-xr-x  2 root root  4096 Jan 28  2024 proc
drwx------  3 root root  4096 Sep  1 22:02 root
drwxr-xr-x  4 root root  4096 Apr 24 12:26 run
lrwxrwxrwx  1 root root     8 Apr 24 12:26 sbin -> usr/sbin
drwxr-xr-x  2 root root  4096 Apr 24 12:26 srv
drwxr-xr-x  2 root root  4096 Jan 28  2024 sys
drwxrwxrwt  9 root root  4096 Sep 23 05:15 tmp
drwxr-xr-x 12 root root  4096 Apr 24 12:26 usr
drwxr-xr-x 11 root root  4096 Apr 24 12:26 var

Code:
ls -la /mnt/pve/root/etc/pve/
total 8
drwxr-xr-x  2 root root 4096 Jun 23 14:21 .
drwxr-xr-x 91 root root 4096 Sep  1 21:47 ..

Could it be in this logical volume called data?

Code:
--- Logical volume ---
  LV Name                data
  VG Name                pve
  LV UUID                884sGl-ORLy-pm01-b5qc-0hGP-1YQA-pkiwwa
  LV Write Access        read/write (activated read only)
  LV Creation host, time proxmox, 2024-06-23 14:19:33 +0100
  LV Pool metadata       data_tmeta
  LV Pool data           data_tdata
  LV Status              available
  # open                 0
  LV Size                <49.34 GiB
  Allocated pool data    12.58%
  Allocated metadata     1.79%
  Current LE             12631
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:6

Is it possible to mount this volume?
 
/etc/pve is a fuse mount of the pve sqlite database /var/lib/pve-cluster/config.db which could be read directly with sqlite3 cmd's ... but it's just easier to use it in /etc/pve while pve is bootet.
 
/etc/pve is a fuse mount of the pve sqlite database /var/lib/pve-cluster/config.db which could be read directly with sqlite3 cmd's ... but it's just easier to use it in /etc/pve while pve is bootet.
Hi @waltar,
thanks I manage to get the 100.conf from the config.db file.

Now what, can I do a container in the new server and replace the config file and the disk file?

Code:
ls
100.conf 
config.db 
vm-100-disk-0

It will work or is there a better solution?
 
Most of all could and so should be done in the pve web-gui. The recovery from a vm/lxc .conf file "in shell" bring back your vm/lxc disk-file into the web-gui and is just in case for broken os disk or any mistakes.
 
Hello @waltar,

after all, it was simpler than I thought.
I had a backup in the disk and put it in the dump directory (/var/lib/vz/dump/ ) on the new server, and just restored the container.

I have the container running right now :)

Thank you so much for your help
 
  • Like
Reactions: waltar

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!