A Tale of two Hypervisors
Mirko Torrez Contreras
Freelance Technical Translator and Writer | Certified Profibus and Profinet Engineer and Trainer I Explosion Protection Consultant and Trainer | Technology evolution storyteller
Why do I use VMs
The list of cases where the use of virtual machines (VM) is not only useful but almost indispensable is growing every day. In my personal case, since most suppliers of automation systems provide software environments that require heavily modified versions of the Windows operating system (OS), therefore you need a specific machine to run each system.
That issue makes it economically impossible to provide support for users of different systems unless you create specific VMs for each system, and then you can have several automation systems software packages running in a single workstation, each in its own VM. Of course, that workstation must have the required resources to run the VM at an adequate speed. With enough resources, you can run several VMs on a single workstation and even create a virtual network between them, which is a handy feature for networking tests.
The need for a Hypervisor
If you are still reading this post at this time, then you know what a VM is, and you also will know that to run a VM in a computer, you will need either virtualization software or virtualization hardware or a combination of both. This will provide the emulation of a real machine, on a host machine. Your VMs will be guests of the host system.
Modern VM solutions use a Virtual Machine Monitor or hypervisor to perform the previously mentioned duties of hosting VM guests.
There is more than one kind of these things
There are two kinds of hypervisors, creatively named Type 1 and Type 2, they offer the same functionalities, but they work differently:
- Type 1 hypervisors a.k.a. native hypervisors offer direct access and control to the hardware and by doing so, generally can provide better performance overall. They are also called bare-metal hypervisors. Examples of this kind of solution are Microsoft Hyper-V, Xen, VMware ESXi, and, curiously, Microsoft Xbox One system software.
- Type 2 hypervisors run on a conventional OS like any other piece of software. A VM guest runs like a process on the host. In this case, the hypervisor creates an abstract virtual hardware platform that separates the VM from the real hardware. Examples of this approach are the most familiar with users: Parallels Desktop for Mac, VirtualBox, and VMware Player and Workstation.
Comparison of Hypervisor types
The hardware support factor
Due to the growing need for VM support and better performance, CPU suppliers started to add specific instruction sets into their CPUs to improve their performance while running these VM platforms. If you are using a middle to upper-level CPU that is newer than 10 years, chances are that it supports hardware-based virtualization (VT or VTx extensions), which can be enabled from the system’s BIOS.
Some historical background
When I started using VMs, the first free option available, as far as I can remember, was called VirtualBox. Its creator, a Germany based company called Innotek Gmbh, offered it as a free solution for personal use in 2007. Afterward, it was released under the GNU license. Sun Microsystems acquired Innotek in 2008 and Oracle acquired Sun in 2010. The software is currently named “Oracle VM VirtualBox”.
But the 500 pounds gorilla of the virtualization market is VMware. This company was created in 1998 and its call to fame was the development of the first successful x86 architecture virtualization. Their first product was called VMware Workstation and was made available in 1999. Then the company gained momentum continuously, being acquired by EMC in 2003, which was then acquired by Dell in 2016. VMware offers a vast portfolio of virtualization solutions for every possible application and scale. As an example, if you know what Amazon Web Services are, you will also know that most of the Internet runs on them. Well, Amazon Web Services run on VMware Cloud services. That represents 33% of the Cloud market, of which Microsoft owns 18% and Google has a meager 8%.
VMs for the rest of us
For us, simple humans, VMware offers the free Type 2 hypervisors called VMware workstation for the Linux and Windows 64 bits OS and VMware Fusion for the Mac OS.
The company restructured in 2016, then liberated VMware Workstation 12.5 and Fusion 8.5 as free software for personal use.
Common household PCs were not able to run VM software smoothly until the late 00s, so VM solutions were business or academic centered products.
But newer hardware started to offer native CPU support for virtualization, whether you knew what this meant or not.
The issue
I started to use VirtualBox in 2008, switched to VMware in 2016 and I have been using VMware Workstation 12.5 until last week.
Last week my main Windows PC received the latest Windows 10 upgrade and an ominous message stated that this upgrade was not compatible with VMware 12.5 which had to be uninstalled to enable the upgrade.
That sent me to the VMware website to find out what to do since I remembered that the reason why I was still using version 12.5 had to do with some CPU compatibility issue. And I was right: version 13 was never published and starting from version 14.0, VMware decide not to support CPUs older than the ones from 2011.
My workstation has a Lynnfield Core i5 750 launched in 2009. I assembled it in 2011. Which meant no more VMware support for me.
A quick course on practical virtualization support
Having 6 or 7 different VMs with several combinations of software configurations, my choices were limited: skip the Windows update (not a wise decision for security reasons), upgrade my workstation (not possible for economic reasons), or find an alternative hypervisor.
So, I went back to VirtualBox, which after all these years worked solidly as a rock (current latest version is 6.1.16), but the graphics performance is somewhat limited due to the 128 Mb Video RAM limit for 3d accelerated graphics.
Looking for a better alternative. I remembered some articles about Windows 10 Pro support for Microsoft’s Hyper-V hypervisor. Then I started to google and found that Hyper-V was a Type 1 hypervisor that apparently would offer better performance and functionality than a Type 2 hypervisor.
I enabled the Hyper-V functionality on my Windows 10 Pro installation (is listed as a Windows feature) and then went through several tutorials on how to use this gizmo.
VMs use what is called a virtual disk format. This is a file type that contains the VMs virtual hard disk image. VMware’s file format is called VMDK and is open. VirtualBox’s file format is called VDI and Microsoft’s format is called VHD. There are tools to convert one into another rather easily, but it is a time-consuming process. And nerve breaking, since you are converting really big files (about 60 to 70 Gb for each VM) and if something happens with your drives while doing that, then you are in trouble.
Finally, I was able to make the conversion from VMDK to VDI and then to VHD file formats and then I found that Type 1 and Type 2 hypervisors cannot work in the same machine at the same time. If you enable Hyper-V in Windows 10, then you cannot run either VMware Workstation or VirtualBox. That is because the CPU instructions are accessed directly by the Type 1 hypervisor, so the Type 2 Hypervisor does not detect them, making it impossible for them to run.
After checking out some forums I found that the easiest way to switch from Type 1 hypervisor support to Type 2 support and vice versa was either disabling Hyper-V or enabling it from the command line as follows:
“In an elevated Command Prompt write this:
To disable:
bcdedit /set hypervisorlaunchtype off
To enable:
bcdedit /set hypervisorlaunchtype auto
(restart to take effect)”.
Then I had VirtualBox if I needed and supposedly Hyper-V also. VirtualBox worked flawlessly when I disabled Hyper-V. Then I enabled Hyper-V and, following a tutorial, created a VM using a VMware VMDK file converted to VHD.
The Hyper-V manager informed me that the VM was running, but I could only see a black screen.
Finally, things work again
After a few trials, I went back to Google and did some additional research. The problem was specific to Windows 7 VMs. The solution was to initially boot the Windows 7 VMs from an installation disc or ISO image, go into safe mode with command prompt, and fix the boot sector of the VM’s virtual hard disk as follows:
bootsect /nt60 all /force
This command fixes the boot sector of a Windows Vista/7/8 installation. If you have Windows XP or 2000 you must use nt52. This problem apparently is not present in Windows 10.
After several hours of work, I finally was able to start my VMs in Hyper-V successfully. And they seem to work faster and employ fewer machine resources than VMware, although since I did not perform any tests, this is just a feeling.
P.S.
This little adventure is proof that whenever a company decides to leave part of its customers’ base in order to perform the continuous improvement of their products, sometimes they may lose a few ones.
In any case, that day of work was fascinating, although definitively exhausting.
I hope this info may be useful for anybody dealing with these topics.
Mirko Torrez Contreras is a Freelance Process Automation Consultant that likes solving unexpected software issues on his weekends, which, due to the current global ongoing situation, do not particularly differ that much from his workdays. He also works writing technical articles and doing translations from English to Spanish and vice versa. Currently working on IT/OT integration projects.
Coordinador de Control de Procesos
4 年Excelente artículo Mirko Torrez Contreras! Cómo todo lo que publicas ??