How to edit config for LXC backup

citizen3rased

New Member
Sep 8, 2023
6
1
3
I backed up an LXC container to a zfs pool before reinstalling proxmox on the host (after making hardware changes). After reinstalling I reimported the pool and tried to restore the container from the backup, however, I am receiving errors with restoring due to parameters existing in the config that no longer correlate with the host. I simply want to remove a few lines from the config file then restore. I am having trouble finding anyway to do this in the documentation. It seems like something that would be fairly useful and not uncommon considering people restore to different nodes as well. Is there anyway to open up the backup and edit the config before restoring? Or any other way to do this?
 
Yes you asked how to edit the backupped config file before doing a restore. The config file and the virtual disks are packed via vma and then optionally compressed. So to edit it you would need to uncompress+unpack it, do your change and then pack(+compress) it again.

Or how did you create that backup, because you are taking about a "tar.zstd". According to Wiki "tar" would mean PVE <2.3 but zstd would mean PVE >6.2. So I'm a bit confused.
 
Last edited:
I'm on proxmox 8.0. It's an LXC backup using zstd. It results in 3 files:
'vzdump-lxc-100-2023_09_02-14_19_57.tar.zst'
'vzdump-lxc-100-2023_09_02-14_19_57.tar.zst.notes'
'vzdump-lxc-100-2023_09_02-14_19_57.log'

I can uncompress the .tar.zst and access the container's filesystem, but where exactly is the '100.conf' that PVE uses for the container setup within the container's filesystem? What's odd is PVE has the button in the backup tab that allows you to 'Show Configuration', which shows the configuration that I need to edit before any uncompressing happens, but where is it sourcing this from? If it can already see this config (without any obvious decompression happening), it leads me to believe it exists outside of the compressed .tar.zst. But I could be wrong..
I could just copy out what I need from the filesystem and create an entirely new container and import the data back into it, however, I'm really surprised this isn't something that can be done. Why can the GUI show the config, but not allow you to edit it? I don't mind getting dirty in the CLI, but it's also not clear where the config file that PVE uses is located within it.
 
Thanks, I got it. Just curious where you copied the line from that says where the configuration file is.. I did a search in the link you shared but didn't see it on that page.
I couldn't find this particular workflow anywhere online, so I wrote up how I successfully edited and restored an LXC backup:

Code:
How to edit the configuration for an LXC container backup:


Navigate to backup location
example: /tank/backups/dump


create temp under the dump directory:
mkdir temp


Find vzdump-lxc..tar.zst for container and extract contents to the temp directory:

tar --zstd -cf vzdump-lxc-100-2023_09_02-14_19_57.tar.zst temp/*


Modify configuration file located at etc/vzdump/pct.conf:

nano etc/vzdump/pct.conf

Repack and compress your container backup with the edited conf file.
Make sure your PWD is at the root of extracted container filesystem. (ie: /tank/backups/dump/temp/)
Run:

tar -czpf ../vzdump-lxc-100-2023_09_02-14_19_57.tar.zst ./etc/vzdump/pct.conf .

The pct.conf must be the first file otherwise it won't be found by PVE.
 
  • Like
Reactions: Dunuin

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!