物理または仮想マシンを Incus インスタンスにインポートするには¶
Incus は既存のディスクやイメージに基づく Incus インスタンスを作成するツール(incus-migrate
)を提供しています。
このツールは Linux マシン上で実行できます。 まず Incus サーバーに接続して空のインスタンスを作成します。このインスタンスはマイグレーション中またはマイグレーション後に設定を変更できます。 次にこのツールはあなたが用意したディスクまたはイメージからインスタンスにデータをコピーします。
注釈
マイグレーションプロセスの最中に新しいインスタンスを設定したい場合は、マイグレーションプロセスを開始する前にあなたのインスタンスで使用したいエンティティをセットアップしてください。
デフォルトでは、新しいインスタンスは default
プロファイルで指定されたエンティティを使用します。
設定をカスタマイズするために異なるプロファイル(あるいはプロファイルのリスト)を設定できます。
詳細は プロファイルを使用するには を参照してください。
また、使用される インスタンスオプション、storage pool、ストレージボリュームのサイズ、network をオーバーライドできます。
あるいは、マイグレーションの完了後にインスタンス設定を変更することもできます。
このツールはコンテナと仮想マシンの両方を作成できます:
コンテナを作成する際は、コンテナのルートファイルシステムを含むディスクまたはパーティションを用意する必要があります。 たとえば、これはあなたがツールを実行しているマシンまたはコンテナの
/
ルートディスクかもしれません。仮想マシンを作成する際は、起動可能なディスク、パーティション、またはイメージを用意する必要があります。 これは単にファイルシステムを用意するだけでは不十分であり、実行中のコンテナから仮想マシンを作成することはできないことを意味します。 また使用中の物理マシンから仮想マシンを作成することもできません。これはマイグレーションツールがコピーしようとするディスクを使用するからです。 代わりに、起動可能なディスク、起動可能なパーティション、または現在使用中でないディスクを用意してください。
Tip
(Q35/
virtio-scsi
ありの QEMU/KVM 以外の)外部のハイパーバイザーから Windows VM を変換したい場合、 Windows にvirtio-win
ドライバーをインストールする必要があります。さもないと VM は起動しません。Windows VM にどのようにひすようなドライバーを統合するかを見るには展開
ホスト上で必要なツールをインストール:virt-v2v
バージョン 2.3.4 以上(これが--block-driver
オプションに対応する最小バージョン)をインストール。virtio-win
パッケージをインストール、あるいはvirtio-win.iso
イメージをダウンロードして/usr/share/virtio-win
フォルダーに配置。さらに
rhsrvany
にインストールする必要がある場合もある。
これで
virt-v2v
を使って外部のハイパーバイザーのイメージを Incus のraw
イメージに変換して必要なドライバーを含められます:# 例 1。vmdk ディスクイメージを incus-migrate に適した raw イメージに変換する sudo virt-v2v --block-driver virtio-scsi -o local -of raw -os ./os -i vmx ./test-vm.vmx # 例 2。QEMU/KVM qcow2 イメージを変換し virtio-scsi ドライバーを統合する sudo virt-v2v --block-driver virtio-scsi -o local -of raw -os ./os -if qcow2 -i disk test-vm-disk.qcow2
結果のイメージは
os
ディレクトリー内に生成され、次のステップでincus-migrate
で使えます。
既存のマシンを Incus インスタンスにマイグレートするには以下の手順を実行してください:
最新の Incus release の Assets セクションから
bin.linux.incus-migrate
ツール(bin.linux.incus-migrate.aarch64
またはbin.linux.incus-migrate.x86_64
)をダウンロードしてください。ツールをインスタンスを作成したいマシン上に配置して (通常
chmod u+x bin.linux.incus-migrate
を実行して)実行可能にしてください。マシンに
rsync
がインストールされているか確認してください。 インストールされていない場合は(たとえば、sudo apt install rsync
で)インストールしてください。ツールを実行します:
sudo ./bin.linux.incus-migrate
ツールはマイグレーションに必要な情報を入力するようプロンプトを出します。
Tip
ツールをインタラクティブに実行する代わりの方法として、設定をパラメータでコマンドに指定することもできます。 詳細は
./bin.linux.incus-migrate --help
を参照してください。Incus サーバーの URL を、 IP アドレスまたは DNS 名で指定してください。
注釈
Incus サーバーは ネットワークに公開 する必要があります。 ローカルの Incus サーバーにインポートしたい場合も、それをネットワークに公開する必要があります。 その後、ローカルサーバーにアクセスするには IP アドレスとして
127.0.0.1
を指定できます。証明書のフィンガープリントを確認してください。
認証の方法を選択してください(リモートAPI認証 参照)。
たとえば、証明書トークンを選ぶ場合、 Incus サーバーにログオンしてマイグレーションツールを実行中のマシン用のトークンを
incus config trust add
で作成してください。 次に生成されたトークンを、ツールを認証するのに使用してください。コンテナと仮想マシンのどちらを作成するか選択してください。 コンテナと仮想マシンについて を参照してください。
作成するインスタンスの名前を指定してください。
ルートファイルシステム(コンテナの場合)、起動可能なディスク、パーティションまたはイメージファイル(仮想マシンの場合)のパスを指定します。
コンテナの場合、必要に応じてファイルシステムのマウントを追加します。
仮想マシンの場合、セキュアブートがサポートされているかを指定します。
任意で、新しいインスタンスを設定します。 プロファイルを指定するか、設定オプションやストレージを変更したりネットワークを設定する設定オプションを直接指定できます。
あるいは、マイグレーション後に新しいインスタンスを設定することもできます。
マイグレーションの設定が完了したら、マイグレーションプロセスを開始します。
コンテナにインポートする出力例を見るには展開
user@host:~$
sudo ./bin.linux.incus-migrate
Please provide Incus server URL: https://192.0.2.7:8443
Certificate fingerprint: xxxxxxxxxxxxxxxxx
ok (y/n)? y
1) Use a certificate token
2) Use an existing TLS authentication certificate
3) Generate a temporary TLS authentication certificate
Please pick an authentication mechanism above: 1
Please provide the certificate token: xxxxxxxxxxxxxxxx
Remote Incus server:
Hostname: bar
Version: 5.4
Would you like to create a container (1) or virtual-machine (2)?: 1
Name of the new instance: foo
Please provide the path to a root filesystem: /
Do you want to add additional filesystem mounts? [default=no]:
Instance to be created:
Name: foo
Project: default
Type: container
Source: /
Additional overrides can be applied at this stage:
1) Begin the migration with the above configuration
2) Override profile list
3) Set additional configuration options
4) Change instance storage pool or volume size
5) Change instance network
Please pick one of the options above [default=1]: 3
Please specify config keys and values (key=value ...): limits.cpu=2
Instance to be created:
Name: foo
Project: default
Type: container
Source: /
Config:
limits.cpu: "2"
Additional overrides can be applied at this stage:
1) Begin the migration with the above configuration
2) Override profile list
3) Set additional configuration options
4) Change instance storage pool or volume size
5) Change instance network
Please pick one of the options above [default=1]: 4
Please provide the storage pool to use: default
Do you want to change the storage size? [default=no]: yes
Please specify the storage size: 20GiB
Instance to be created:
Name: foo
Project: default
Type: container
Source: /
Storage pool: default
Storage pool size: 20GiB
Config:
limits.cpu: "2"
Additional overrides can be applied at this stage:
1) Begin the migration with the above configuration
2) Override profile list
3) Set additional configuration options
4) Change instance storage pool or volume size
5) Change instance network
Please pick one of the options above [default=1]: 5
Please specify the network to use for the instance: incusbr0
Instance to be created:
Name: foo
Project: default
Type: container
Source: /
Storage pool: default
Storage pool size: 20GiB
Network name: incusbr0
Config:
limits.cpu: "2"
Additional overrides can be applied at this stage:
1) Begin the migration with the above configuration
2) Override profile list
3) Set additional configuration options
4) Change instance storage pool or volume size
5) Change instance network
Please pick one of the options above [default=1]: 1
Instance foo successfully created
仮想マシンにインポートする出力例を見るには展開
user@host:~$
sudo ./bin.linux.incus-migrate
Please provide Incus server URL: https://192.0.2.7:8443
Certificate fingerprint: xxxxxxxxxxxxxxxxx
ok (y/n)? y
1) Use a certificate token
2) Use an existing TLS authentication certificate
3) Generate a temporary TLS authentication certificate
Please pick an authentication mechanism above: 1
Please provide the certificate token: xxxxxxxxxxxxxxxx
Remote Incus server:
Hostname: bar
Version: 5.4
Would you like to create a container (1) or virtual-machine (2)?: 2
Name of the new instance: foo
Please provide the path to a root filesystem: ./virtual-machine.img
Does the VM support UEFI Secure Boot? [default=no]: no
Instance to be created:
Name: foo
Project: default
Type: virtual-machine
Source: ./virtual-machine.img
Config:
security.secureboot: "false"
Additional overrides can be applied at this stage:
1) Begin the migration with the above configuration
2) Override profile list
3) Set additional configuration options
4) Change instance storage pool or volume size
5) Change instance network
Please pick one of the options above [default=1]: 3
Please specify config keys and values (key=value ...): limits.cpu=2
Instance to be created:
Name: foo
Project: default
Type: virtual-machine
Source: ./virtual-machine.img
Config:
limits.cpu: "2"
security.secureboot: "false"
Additional overrides can be applied at this stage:
1) Begin the migration with the above configuration
2) Override profile list
3) Set additional configuration options
4) Change instance storage pool or volume size
5) Change instance network
Please pick one of the options above [default=1]: 4
Please provide the storage pool to use: default
Do you want to change the storage size? [default=no]: yes
Please specify the storage size: 20GiB
Instance to be created:
Name: foo
Project: default
Type: virtual-machine
Source: ./virtual-machine.img
Storage pool: default
Storage pool size: 20GiB
Config:
limits.cpu: "2"
security.secureboot: "false"
Additional overrides can be applied at this stage:
1) Begin the migration with the above configuration
2) Override profile list
3) Set additional configuration options
4) Change instance storage pool or volume size
5) Change instance network
Please pick one of the options above [default=1]: 5
Please specify the network to use for the instance: incusbr0
Instance to be created:
Name: foo
Project: default
Type: virtual-machine
Source: ./virtual-machine.img
Storage pool: default
Storage pool size: 20GiB
Network name: incusbr0
Config:
limits.cpu: "2"
security.secureboot: "false"
Additional overrides can be applied at this stage:
1) Begin the migration with the above configuration
2) Override profile list
3) Set additional configuration options
4) Change instance storage pool or volume size
5) Change instance network
Please pick one of the options above [default=1]: 1
Instance foo successfully created
マイグレーションが完了したら、新しいインスタンスをチェックし、設定を新しい環境にあわせて更新してください。 通常は、少なくともストレージ設定(
/etc/fstab
)とネットワーク設定を更新する必要があります。