物理または仮想マシンを Incus インスタンスにインポートするには¶
Incusは既存のディスクやイメージに基づくIncusインスタンスやボリュームを作成するツール(incus-migrate)を提供しています。
このツールはLinuxマシン上で実行できます。 まずローカルまたはリモートのIncusサーバーに接続して空のインスタンスまたはボリュームを作成します。このインスタンスはマイグレーション中またはマイグレーション後に設定を変更できます。 次にこのツールはあなたが用意したディスクまたはイメージからデータをコピーします。
incus-migrateはraw、qcow2、ova、vmdkファイル形式のイメージをインポートできます。URLを指定してイメージを直接ダウンロードすることもできます。
注釈
マイグレーションプロセスの最中に新しいインスタンスを設定したい場合は、マイグレーションプロセスを開始する前にあなたのインスタンスで使用したいエンティティをセットアップしてください。
デフォルトでは、新しいインスタンスは 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で作成してください。 次に生成されたトークンを、ツールを認証するのに使用してください。コンテナと仮想マシンのどちらを作成するか選択してください。 コンテナと仮想マシンについて を参照してください。
作成するインスタンスの名前を指定してください。
ルートファイルシステム(コンテナの場合)、起動可能なディスク、パーティションまたはイメージファイル(仮想マシンの場合)のパスを指定します。
コンテナの場合、必要に応じてファイルシステムのマウントを追加します。
仮想マシンの場合、セキュアブートがサポートされているかを指定します。
任意で、新しいインスタンスを設定します。 プロファイルを指定するか、設定オプションやストレージを変更したりネットワークを設定する設定オプションを直接指定できます。
あるいは、マイグレーション後に新しいインスタンスを設定することもできます。
マイグレーションの設定が完了したら、マイグレーションプロセスを開始します。
コンテナにインポートする出力例を見るには展開
~$sudo ./bin.linux.incus-migrateThe local Incus server is the target [default=yes]:What would you like to create?1) Container2) Virtual Machine3) Virtual Machine (from .ova)4) Custom VolumePlease enter the number of your choice: 1Name of the new instance: fooPlease provide the path to a root filesystem: /Do you want to add additional filesystem mounts? [default=no]:Instance to be created:Name: fooProject: defaultType: containerSource: /Additional overrides can be applied at this stage:1) Begin the migration with the above configuration2) Override profile list3) Set additional configuration options4) Change instance storage pool or volume size5) Change instance networkPlease pick one of the options above [default=1]: 3Please specify config keys and values (key=value ...): limits.cpu=2Instance to be created:Name: fooProject: defaultType: containerSource: /Config:limits.cpu: "2"Additional overrides can be applied at this stage:1) Begin the migration with the above configuration2) Override profile list3) Set additional configuration options4) Change instance storage pool or volume size5) Change instance networkPlease pick one of the options above [default=1]: 4Please provide the storage pool to use: defaultDo you want to change the storage size? [default=no]: yesPlease specify the storage size: 20GiBInstance to be created:Name: fooProject: defaultType: containerSource: /Storage pool: defaultStorage pool size: 20GiBConfig:limits.cpu: "2"Additional overrides can be applied at this stage:1) Begin the migration with the above configuration2) Override profile list3) Set additional configuration options4) Change instance storage pool or volume size5) Change instance networkPlease pick one of the options above [default=1]: 5Please specify the network to use for the instance: incusbr0Instance to be created:Name: fooProject: defaultType: containerSource: /Storage pool: defaultStorage pool size: 20GiBNetwork name: incusbr0Config:limits.cpu: "2"Additional overrides can be applied at this stage:1) Begin the migration with the above configuration2) Override profile list3) Set additional configuration options4) Change instance storage pool or volume size5) Change instance networkPlease pick one of the options above [default=1]: 1Instance foo successfully created仮想マシンにインポートする出力例を見るには展開
~$sudo ./bin.linux.incus-migrateThe local Incus server is the target [default=yes]:What would you like to create?1) Container2) Virtual Machine3) Virtual Machine (from .ova)4) Custom VolumePlease enter the number of your choice: 2Name of the new instance: fooPlease provide the path to a root filesystem: ./virtual-machine.imgDoes the VM support UEFI Secure Boot? [default=no]: noInstance to be created:Name: fooProject: defaultType: virtual-machineSource: ./virtual-machine.imgConfig:security.secureboot: "false"Additional overrides can be applied at this stage:1) Begin the migration with the above configuration2) Override profile list3) Set additional configuration options4) Change instance storage pool or volume size5) Change instance networkPlease pick one of the options above [default=1]: 3Please specify config keys and values (key=value ...): limits.cpu=2Instance to be created:Name: fooProject: defaultType: virtual-machineSource: ./virtual-machine.imgConfig:limits.cpu: "2"security.secureboot: "false"Additional overrides can be applied at this stage:1) Begin the migration with the above configuration2) Override profile list3) Set additional configuration options4) Change instance storage pool or volume size5) Change instance networkPlease pick one of the options above [default=1]: 4Please provide the storage pool to use: defaultDo you want to change the storage size? [default=no]: yesPlease specify the storage size: 20GiBInstance to be created:Name: fooProject: defaultType: virtual-machineSource: ./virtual-machine.imgStorage pool: defaultStorage pool size: 20GiBConfig:limits.cpu: "2"security.secureboot: "false"Additional overrides can be applied at this stage:1) Begin the migration with the above configuration2) Override profile list3) Set additional configuration options4) Change instance storage pool or volume size5) Change instance networkPlease pick one of the options above [default=1]: 5Please specify the network to use for the instance: incusbr0Instance to be created:Name: fooProject: defaultType: virtual-machineSource: ./virtual-machine.imgStorage pool: defaultStorage pool size: 20GiBNetwork name: incusbr0Config:limits.cpu: "2"security.secureboot: "false"Additional overrides can be applied at this stage:1) Begin the migration with the above configuration2) Override profile list3) Set additional configuration options4) Change instance storage pool or volume size5) Change instance networkPlease pick one of the options above [default=1]: 1Instance foo successfully createdマイグレーションが完了したら、新しいインスタンスをチェックし、設定を新しい環境にあわせて更新してください。 通常は、少なくともストレージ設定(
/etc/fstab)とネットワーク設定を更新する必要があります。