How to recover LXC guests from corrupted proxmox installation?

Raging_Demon

New Member
Mar 17, 2025
6
0
1
I have a HDD containing LXC's I would like to recover. I can mount the faulty HDD, and see the filesystem. I'm confident I can recover the thin LVM disks for the LXC's, I was wondering how the recovered LVM's could be used in new LXC's.
I remember the LXC's were a nextcloud turnkey container, and a vanilla Ubuntu container (either 20.04 or 24.10).
Hopefully this is possible, I have learned the hard way to make sure my Proxmox installation is backed up somewhere.
 
On which system do you mount the HDD? Is it a usual Debian/Ubuntu or similar or do you do that on a Proxmox VE?

What would I try:
Run vgscan and then have a look for the name of your volume group, most likely pve.

Only if you working on a PVE node: run lsblk, look for the HDD device path and then use this path in command vgimportclone /dev/<HDD>. If the volume group on the HDD had the name pve it will be imported as pve1. This is important for following commands.

Run vgchange <vgname> -ay to activate it.
Run lvs to view the names of the logical volumes.
Mount the volume of your interest somewhere with mount /dev/<vg-name>/<lv-name> <target>, for example mount /dev/pve/vm-100-disk-0 /media and use tar --numeric-owner --acls --xattrs --zstd -czf /tmp/lxc-disk-100.tar.zst -C /media to make a copy of the content.

If you still have the config file of the lxc at hand, you can even include it into the tar and then use the tar like any other lxc backup made by PVE.

Example for a config file with name 100.conf:
tar --numeric-owner --acls --xattrs --zstd --transform='s|^100.conf|etc/vzdump/pct.conf|' -cf vzdump-lxc-100.tar.zst -C <path-to-conf> 100.conf -C /mnt/recovery .
If you move the resulting file on a PVE backup storage you can restore the container.

As you didn't tell, what was faulty on the HDD, you might encounter problems during any of the steps.