How to restore a container when the container.conf is lost?

jahknem

New Member
Dec 2, 2019
15
0
1
29
The title says it all. I reinstalled my proxmox installation due to it being less of a hassle then undoing all my worng configurations choices. When trying to restore the backups one of them failed.
I still have the subvol disks on the ZFS Pool, however I haved lost the conf files due to reinstalling the system.
Is there any way that I can restore the container without the <ctid>.conf?
 
Create a new container with the same settings (but with a different VMID) as your previous one, but give it a new disk on the same ZFS pool (size doesn't matter, you can make it tiny to save space).

Let's say your old container had VMID 120 and the new one 140, you can recover your old rootfs like so (substitute your actual VMIDs of course, if you don't remember your old container's ID, do zfs list, it's in the name of the subvolume, e.g. subvol-120-disk-0):
Code:
# zfs destroy poolname/subvol-140-disk-0  (really make sure 140 is your *new* VMID, this deletes data!)
# zfs rename poolname/subvol-120-disk-0 poolname/subvol-140-disk-0
# pct rescan

The last command should tell you that it "updated volume size of X in config". Then start your container and you should be good to go!
 
Last edited:
Does it have to be the exact same settings? As I don't remember all of them. I still have the IP address, the password, CTID and host name, however I'm not sure about how the other settings

EDIT: So I tried that and I'm not able to log in. When doing a port scan the services which are supposed to run on the Container are not available and when trying to ssh into the container the connection is closed by the remote host..
Specifically I created a container which has to the best of my knowledge the same settings (and definitely the same password), then destroyed the subvol of the new container and renamed the old to the new container. Ran the pct rescan (interestingly enough it changed more than one container). Started the new container and was unable to log in
 
Last edited:
EDIT: So I tried that and I'm not able to log in. When doing a port scan the services which are supposed to run on the Container are not available and when trying to ssh into the container the connection is closed by the remote host..
Can you access the container via the Web GUI (or alternatively via 'pct enter <vmid>' on the PVE host)? If so, make sure the network settings carried over successfully.
 
No, Access over the web shell is not really possible. It shows the login routine, however it does not accept the password.
I found most of my files on a backup, so I'm thinking of just creating a new container.

What is the best practice of storing data on proxmox? Up to now I always stored the data for each container in the respective subvolume, disregarding non wanted redundancy.
However as I'm now starting over, what is the best way to create a shared storage space for data in general?
Thanks :)
 
You can check our documentation to see which storage options are available. Shared storage between containers is usually done with network shares for simplicity, alternatively, you can create a bind-mount to a directory in all CTs that need it.
 
  • Like
Reactions: jahknem

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!