Skip to content

Instantly share code, notes, and snippets.

@biophonc
Last active October 19, 2022 16:40
Show Gist options
  • Save biophonc/2eded447d1f98ebdda34 to your computer and use it in GitHub Desktop.
Save biophonc/2eded447d1f98ebdda34 to your computer and use it in GitHub Desktop.
Migrate Vagrant VirtualBox VM to VMware Fusion

Migrate Vagrant VirtualBox VM to VMware Fusion

Notes:

  • Unfortunately the process is not as simple as I'd have expected it, that's why I wrote this little step-by-step instruction.
  • My setup is/was:
    • OSX 10.9.4
    • VirtualBox 4.3.12
    • VMware Fusion 6.0.4
    • OS as VM to migrate: Ubuntu 10.04.4 LTS

Export from VirtualBox

  1. Open Oracel VM VirtualBox Manager
  2. Make sure the VM is powered off
  3. Go to 'File' > 'Export Appliance', select your instance and hit 'next'.
  4. Change destination folder for the *.ova if you like
  5. Set Format to 'OVF 1.0' and push 'next'
  6. Change some Appliance Settings if you like. Hit the 'export button' and get a coffee

Import into VMware

  1. Go to 'add' > 'import' and select your previouly created .ova image
  2. Change the destination folder if you like and push 'save'
    • VMware may inform you that the image does not passed the OVF specs - ignore it an retry. It should work anyway.

Prepare box

  1. Go to location where your VMNAME.vmwarevm exists in cd into it.
  2. Make sure a 'metadata.json' file is in it. Otherweise create it. The minimum content should be: {"provider":"vmware_fusion"} For more info read: https://docs.vagrantup.com/v2/boxes/format.html
  3. run tar cvzf NAME.box ./*to pack it. (This may take a while, so get a coffee)

Use it with Vagrant

  1. Backup the 'Vagrantfile' and the '.vagrant/'' folder
  2. Comment all providespecific settings in you Vagrantfile
  3. To add the box run: vagrant box add /path/to/VMNAME.vmwarevm/NAME.box --provider=vmware_fusion --name=NAME (Relax and enjoy your coffee)
# The output should look something like this:
b21:htdocs biophonc$ vagrant box add /Virtual-Machines/pp.vmwarevm/pp.box --provider=vmware_fusion --name=pp
==> box: Adding box 'pp' (v0) for provider: vmware_fusion
    box: Downloading: file:///Virtual-Machines/pp.vmwarevm/pp.box
==> box: Successfully added box 'pp' (v0) for 'vmware_fusion'!
  1. Verify it by fireing it up:
b21:htdocs biophonc$ vagrant up
Bringing machine 'default' up with 'vmware_fusion' provider...
==> default: Cloning VMware VM: 'pp'. This can take some time...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
==> default: Starting the VMware VM...
==> default: Waiting for machine to boot. This may take a few minutes...
  default: SSH address: 192.168.27.129:22
  default: SSH username: vagrant
  default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Forwarding ports...
  default: -- 22 => 2222
==> default: Configuring network adapters within the VM...
==> default: Waiting for HGFS kernel module to load...
==> default: Enabling and configuring shared folders...
  default: -- /Volumes/projects/presseportal.v2/htdocs: /vagrant
  default: -- /Volumes/projects/presseportal.v2/htdocs/presseportal: /var/www/presseportal.de
  1. Tweak the provider specific config if you like to...

That's it!

@wired00
Copy link

wired00 commented Feb 21, 2018

Great write up, I'm just confused though for the section Use it with Vagrant. Can you provided examples of what you needed to change?

  • By "providespecific" do you mean comment out all provider specific stuff like conf.vm.provider "virtualbox" do |v| ?
  • Did I need something for config.vm.box = ?

@Fashaun
Copy link

Fashaun commented Mar 19, 2019

Hi,

which files should I keep in the "Prepare box" step

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment