How to migrate a regular LXC container to a Proxmox LXC container?

chriswayg

Renowned Member
Oct 17, 2015
9
0
66
Hi,

how do you migrate a regular LXC container to a Proxmox LXC container, which can be accessed via the Proxmox web GUI?

For example, I have a container created by running:
Code:
lxc-create -n debian8 -t debian -- -r jessie

I can see related data stored in /var/lib/lxc, and such a container has a regular root filesystem, unlike the raw disks created by Proxmox LXC containers, which are mounted on a ZFS rpool. (I'm using ZFS RAID-Z1 for storage, as created by the Proxmox CD installer.)

What is the best procedure to import/convert and register such a container with Proxmox?
 
Hi Dietmar, thanks for responding!

A few more specifics would be helpful and adding the necessary steps to the Migration or LXC wiki page would make it easier to find.

I get "ERROR: archive contains no configuration file"

Where do I find this configuration file? Is it already created by
lxc-create or does it have to be written according to a Proxmox specific format?

Regards,
Christian
 

Where do I find this configuration file? Is it already created by
lxc-create or does it have to be written according to a Proxmox specific format?

Oh, that need to be in proxmox format. The filename is <containerroot>/etc/vzdump/pct.conf
 
So I created the file ./etc/vzdump/pct.conf and added it to the tar archive, using the pattern from a Proxmox created container.
The container seems to be created successfully, but I get the following error:

vm 0 - unable to parse value of 'net0' - format error
hwaddr: value does not match the regex pattern

Depending on the MAC, sometimes the container will fail to start.

lxc-start: conf.c: setup_hw_addr: 2242 ioctl failure : Cannot assign requested address
lxc-start: conf.c: setup_netdev: 2359 failed to setup hw address for 'eth0'

I also tried a web based MAC generator which caused the same errors. What is the correct way to generating a valid MAC?


----------
Code:
$ cat ./etc/vzdump/pct.conf
arch: amd64
cpulimit: 1
cpuunits: 1024
hostname: debian8
memory: 512
net0: bridge=vmbr1,gw=10.10.10.1,hwaddr=35:36:37:38:39:69,ip=10.10.10.244/24,name=eth0,type=veth
ostype: debian
parent: Fressh_Install
rootfs: containers:subvol-244-disk-1,size=4G
swap: 512


$ tar --append --file=c-244-2015_10_24-18_11_55.tar ./etc/vzdump/pct.conf
$ pct restore 244 c-244-2015_10_24-18_11_55.tar -storage containers
[I]vm 0 - unable to parse value of 'net0' - format error[/I]
[I]hwaddr: value does not match the regex pattern[/I]
extracting archive '/var/lib/vz/dump/c-244-2015_10_24-18_11_55.tar'
Total bytes read: 283115520 (270MiB, 109MiB/s)
 
I get the following error:

vm 0 - unable to parse value of 'net0' - format error
hwaddr: value does not match the regex pattern

Depending on the MAC address, sometimes the container will fail to start.

What is the correct way of generating a valid Proxmox MAC address?

Regards,
Christian