Migrate physical server to LXD container
lxd-p2c is developed by LXD team to migrate physical servers into LXD containers.
https://github.com/lxc/lxd/tree/master/lxd-p2c
Static binary files are available in Github. To Download, go to
https://github.com/lxc/lxd/actions
Click on any of the actions with a green tick mark. Under Artifacts, you will see the download link for various operating systems.
Download the Linux.zip file, extract, copy the “lxd-p2c” file to the physical server that you need to convert to LXD container.
Before migrating
You need to stop all services like web server, MySQL server, etc before you run lxd-p2c migration.
Running lxd-p2c
Before you can run the migration, you need to create an LXD container with the same OS as the physical server.
Then run the following command on the physical server to migrate files to the LXD container you created.
./lxd-p2c https://lxdserver:8443 NEW_CONTAINTER_NAME /
It is will ask for LXD password, if you don’t have it, use the following command to reset the password on the LXD server.
lxc config set core.trust_password PASSOWORD_HERE