De VirtualBox vers Hyper-V

Introduction

Cet article montre comment convertir une VM de Virtualbox vers Hyper-V.
Pour exemple, on s’appuiera sur le cas d’un VM virtualbox “modern.ie” fournie par Microsoft pour la faire fonctionner sur Hyper-V.

Outils nécessaires

  • Une console
  • Virtualbox et sa commande VBoxManage
  • Hyper-V et commandes PowerShell associées

Conversion

Image originale

$ curl -LOk http://aka.ms/msedge.win10.vagrant
$ unzip *.zip

Import dans Virtualbox

vboxmanage import 'MSEdge - Win10.ova'
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting /vagrant/Projects/modern.ie_vagrant-win10-edge/MSEdge - Win10.ova...
OK.
Disks:
 vmdisk1 42949672960 -1 http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized MSEdge - Win10-disk001.vmdk -1 -1

Virtual system 0:
 0: Suggested OS type: "Windows10_64"
 (change with "--vsys 0 --ostype <type>"; use "list ostypes" to list all possible values)
 1: Suggested VM name "MSEdge - Win10"
 (change with "--vsys 0 --vmname <name>")
 2: Number of CPUs: 1
 (change with "--vsys 0 --cpus <n>")
 3: Guest memory: 4096 MB
 (change with "--vsys 0 --memory <MB>")
 4: Sound card (appliance expects "", can change on import)
 (disable with "--vsys 0 --unit 4 --ignore")
 5: Network adapter: orig NAT, config 3, extra slot=0;type=NAT
 6: IDE controller, type PIIX4
 (disable with "--vsys 0 --unit 6 --ignore")
 7: IDE controller, type PIIX4
 (disable with "--vsys 0 --unit 7 --ignore")
 8: Hard disk image: source image=MSEdge - Win10-disk001.vmdk, target path=/home/vagrant/VirtualBox VMs/MSEdge - Win10/MSEdge - Win10-disk001.vmdk, controller=6;channel=0
 (change target path with "--vsys 0 --unit 8 --disk path";
 disable with "--vsys 0 --unit 8 --ignore")
0%...10%...

Conversion du format du disque dur

$ vboxmanage clonehd ~/VirtualBox\ VMs/MSEdge\ -\ Win10/MSEdge\ -\ Win10-disk001.vmdk MSEdge-Win10-disk.vhd -format vhd

Création de la VM Hyper-V

New-VM -Name Win10VM -MemoryStartupBytes 4GB -BootDevice VHD -VHDPath .\MSEdge-Win10-disk.vhd -Path .\VMData -Generation 1 -Switch DefaultSwitch

Export de la VM

Export-VM -Name Win10VM -Path .\

Préparation pour vagrant

Structure de répertoire

- VM/xxx.xml
- Hard drive/MSEdge-Win10-disk.vhd
- metadata.json

Contenu metadata

{
 "provider": "virtualbox"
}

Empaquetage

$ tar czvf VM msedgewin10.box

Utilisation avec vagrant

$ vagrant box add msedgewin10 msedgewin10.box

 

Liens utiles

  • https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/get-started/create-a-virtual-machine-in-hyper-v
  • https://www.vagrantup.com/docs/boxes/format.html

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *