I recently had to migrate containers from a proxmox3 (under OpenVZ) to a proxmox4 (under LXC).
Problem, there are a lot of containers to migrate/“convert” to run under LXC. So I needed a way to automate the procedure as much as possible.
Luckily, the migration documentation is very well detailed. So I used it to “bash” the operation.
You can find all the sources on my github
I cut the operation under two scripts, an export script and an import script.
The export :
The export script takes two parameters as input: the container ID
and the IP
of the destination server.
It is also necessary to define some variables that will be used to send data via scp
.
The export procedure is done as follows:
|
|
We check dump is present :
|
|
Then we send it to Proxmox 4
:
|
|
Import :
As for the import, only one argument is passed as input, which is the container’s “ID”.
Then we start the conversion and restoration part.
|
|
I omitted to tell you that there is a small logging system for the operations in order to be able to trace the process a bit.