Showing posts with label virtualization. Show all posts
Showing posts with label virtualization. Show all posts

Friday, May 10, 2019

Migrate a Centos 7 VM from VirtualBox to Hyper-V

Recently I decided I wanted to install Docker Desktop for Windows in order to do some local testing.  The installation process is pretty straightforward but requires Hyper-V be enabled on the machine.  This is automatically done by the installer, but contains one minor inconvenient caveat: once Hyper-V is enabled, VirtualBox no longer functions.  My understanding for this is that Hyper-V is a ring-1 hypervisor which runs your primary OS as an (albeit special) VM.  Because of that, it's no longer possible to run a ring-2 hypervisor like VirtualBox.

There's plenty of guides out there on how to make this migration, but they all seem to be missing at least a few important points.  For the most part I followed this guide which has links to all of the required tools.  Here's the list of issues that I faced that were not covered in that article:

1. Convert-VHD would not recognize by vmdk file.  Ultimately I ended up finding this article which proposed an alternate command: ConvertTo-MvmcVirtualHardDisk. This worked as described in the original article.

2. The original article is a little vague on which lines might need to be commented out in the "desc.txt" file that is created.  I ultimately ended up needing to comment out these:

#ddb.uuid.image="8ce66459-16da-4a18-a56b-6149a49e0de3"
#ddb.uuid.parent="00000000-0000-0000-0000-000000000000"
#ddb.uuid.modification="00000000-0000-0000-0000-000000000000"
#ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"

3. Once those issues were resolved, I had a new vhdx that I was able to attach to a new Hyper-V VM.  Unfortunately it wouldn't boot.  On a normal boot the VM would hang at the graphical boot screen for a few minutes, then fail and dump to the dracut recovery shell.  A look at journalctl indicated that this was because none of the disks were found.  A lot of articles on this issue recommend rebuilding the initramfs by rebooting and choosing the "rescue" option on the GRUB boot menu.  I did find that the rescue option would boot, but unfortunately rebuilding initramfs with: dracut --force didn't seem to have any effect.  Luckily the nice folks on freenode IRC #centos pointed me in the right direction:  my virtualbox VM had the guest additions installed still!  This article explains how to remove the vbox guest additions, but basically just run the installer again with the uninstall argument:

sudo sh /media/VBOXADDITIONS_4.1.10_76795/VBoxLinuxAdditions.run uninstall

Obviously hyper-v has no menu item to mount the guest additions CD, but the .iso can be found at:

C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso

Once that was uninstalled, one final reboot and... bob's your uncle!




Thursday, May 10, 2012

Where does Virtualbox store VMs in Windows XP?

For whatever reason I was having a brainfart about where my VMs were stored whilst in the process of backing them up. Google searches returned very little pertinent information as the search terms involved are used in myriad different contexts in relation to Virtualbox and virtualization in general. The answer is of course:

C:\Documents and Settings\username\Virtualbox VMs\

I'm sure this is configurable, but this appears to be the default directory under an XP host. Happy virtualizing!

Thursday, December 15, 2011

Backup a VirtualBox VM

I just installed FreeBSD 8.2 in VirtualBox 3.2.10_OSE under CrunchBang linux. After getting everything configured in terms of guest additions, and display setup I wanted to take a snapshot. Turns out there's a nifty one step command to facilitate this process that I found on here. Simply run

VBoxManage clonevdi ~/.VirtualBox/HardDisks/image.vdi ~/image_Backup.vdi

That's all there is to it! Easy as pi.

Thursday, November 17, 2011

Convert .ova to .ovf in Linux

I just spent the better part of 20 minutes searching for a method to convert a .ova file downloaded from the web to the .ovf format required by my version of VirtualBox-ose. VMWare has a program called OVFTool that may do this conversion but requires registering to download and may only be available as a windows binary. After hitting several dead ends I found the simple answer. As it turns out the .ova file format is a tar image!

tar xvf SomeVMImage.ova

will dump the .ovf and related files. Easy as pi!