vpsadminos-convert
- convert existing containers into vpsAdminOS.
vpsadminos-convert
command [command options] [arguments...]
vpsadminos-convert
is a tool for converting existing containers into
vpsAdminOS containers. vpsadminos-convert
can convert standard OpenVZ
containers with simfs
with arbitrary file system or ploop
with ext4
.
It can also efficiently convert containers stored in ZFS datasets, e.g.
containers managed by vpsAdmin.
vpsadminos-convert
can be used to export an OpenVZ container into a tar
archive. The exported archive is then copied to vpsAdminOS node by the user
at his convenience and imported using osctl ct import
file, see osctl(8).
It can also migrate containers to vpsAdminOS nodes directly, similarly to
vzmigrate
from OpenVZ Legacy.
vz6 export
[options] ctid file--zfs
to export ZFS streams, which will be much faster. --[no-]consistent
Enable/disable consistent export. When consistently exporting a running
container, the container is stopped, so that applications can gracefully
exit and save their state to disk. Once the export is finished,
the container is restarted.
--compression
auto | off | gzip
Enable/disable compression of the dumped container data. The default is
auto, which uses compresses data if they are stored uncompressed, but
does not compress them twice. gzip enforces compression and off
disables it.
For ZFS, auto means using compressed stream, if the dataset has ZFS
compression enabled and --zfs-compressed-send
is set. If the compression
is not enabled on the dataset or --zfs-compressed-send
is not set, the
stream will be compressed using gzip. off disables compression, the
data is dumped as-is. gzip enforces compression, even if ZFS compression
is enabled and --zfs-compressed-send
is set.
Common options for OpenVZ Legacy
for more command options.vz6 migrate stage
[options] id destination -p
, --port
port
SSH port, defaults to 22
.
Common options for OpenVZ Legacy
for more command options.vz6 migrate sync
idvz6 migrate transfer
idvz6 migrate cleanup
[options] id -d
, --[no-]delete
Delete the container from the source node. The container is not deleted
by default.
vz6 migrate cancel
[options] idvz6 migrate transfer
. -f
, --force
Cancel the migration's state on the local node, even if the remote node
refuses to cancel. This is helpful when the migration state between the
two nodes gets out of sync. The remote node may remain in an unconsistent
state, but from there, the container can be deleted using osctl ct del
if needed.
vz6 migrate now
[options] id destinationvz6 migrate stage
, vz6 migrate sync
, vz6 migrate transfer
and
vz6 migrate cleanup
in succession. -p
, --port
port
SSH port, defaults to 22
.
-d
, --[no-]delete
Delete the container from the source node. The default is to delete the
container.
-y
, --[no-]proceed
By default, vz6 migrate now
asks the user if he wishes to continue after
successful vz6 migrate stage
. The user can review if the config file was
converted adequately and decide to continue or cancel the migration.
Common options for OpenVZ Legacy
for more command options.--zfs
vpsadminos-convert
will export the container's data as ZFS streams.--zfs-dataset
dataset--zfs-subdir
directoryprivate/
, so that the
container does not have access to the special .zfs
directory located
at the dataset root.--zfs-compressed-send
zfs send -c
. This
feature is available since ZFS on Linux 0.7. Compressed send is disabled
by default.--netif-type
bridge
|routed
bridge
and routed
.
Container's IP addresses are assigned to a network interface of the
selected type. See vpsAdminOS documentation for more information about
network configuration.--netif-name
nameeth0
.--netif-hwaddr
addr--bridge-link
interface--netif-type bridge
is set. By default, vpsAdminOS
has bridge named lxcbr0
, so the converter uses it.--vpsadmin
--zfs
--zfs-dataset vz/private/%{veid}
--zfs-subdir private
--netif-type routed
--netif-name eth0
To export container 101
from the OpenVZ node into ct-101.tar
:
openvz-node $ vpsadminos-convert vz6 export 101 ct-101.tar
To import the exported archive on vpsAdminOS:
vpsadminos-node $ osctl ct import ct-101.tar
openvz-node $ vpsadminos-convert vz6 export \
--zfs \
--zfs-dataset vz/private/101 \
--zfs-subdir private \
101 ct-101.tar
The container's rootfs is expected to be in
<mountpoint of zfs-dataset>/<zfs-subdir>
, i.e. by default
/vz/private/101/private
. No other zfs-subdir
than private
is supported
at the moment.
You have to have vpsAdminOS node prepared and running. On the OpenVZ node,
generate a public/private key pair for root
, if you don't already have one:
openvz-node $ ssh-keygen
openvz-node $ cat ~/.ssh/id_rsa.pub
Authorize the key to migrate containers to the vpsAdminOS node:
vpsadminos-node $ osctl migration authorized-keys add
<here you enter the public key>
Now you can continue with migration from either simfs
/ploop
or ZFS
.
Migration from simfs
/ploop
cannot be completely realized through the migration
protocol, because it works only with ZFS streams. Instead, migration from
simfs
/ploop
uses rsync
to copy data to the destination node. rsync
needs
to connect to the destination vpsAdminOS node as a root, so you have to authorize
your key to login as root by adding the public key to
/etc/ssh/authorized_keys.d/root
on the vpsAdminOS node.
When you have SSH configured, you can initiate the migration from the OpenVZ node:
openvz-node $ vpsadminos-convert vz6 migrate now 101 vpsadminos-node
Where vpsadminos-node
is a resolvable hostname or an IP address of the target
node.
Initiate the migration from the OpenVZ node:
openvz-node $ vpsadminos-convert vz6 migrate now \
--zfs \
--zfs-dataset vz/private/101 \
--zfs-subdir private \
101 vpsadminos-node
If you forget to use --zfs
, rsync
will be used to migrate the container even
if it is stored in a ZFS dataset.
Report bugs to https://github.com/vpsfreecz/vpsadminos/issues.
vpsadminos-convert
is a part of vpsAdminOS.