Pushing Nested Virtualization to the Limits
I recently watched a video by SomeOrdinaryGamers in which he decided to install the first version of Windows and upgrade it all the way to Windows 10.
Despite the video's thumbnail, I decided that it would a good idea to do something similar: Install all versions of Windows inside nested VMs.
Sadly, I didn't have access to my supercomputer with 1000s of CPU cores and Terabytes of RAM at the time, so my Legion 7 would have to do. Its specs are as follows:
- AMD Ryzen 7 5800H (8 Cores, 16 Threads, Base 3.2GHz, Turbo 4.4GHz)
- NVIDIA GeForce RTX 3070 Mobile
- 32GB DDR4 3200MHz RAM
- 2TB M.2 NVMe PCIe SSD
About a month ago I completed a single-GPU VFIO passthrough, which allowed me to have near-bare-metal performance on a Windows 10 VM running inside Arch Linux. This meant that my host was pretty much ready to go.
The plan was simple: Install virtualization software on every operating system and create the nested VMs. Easy, right? Well... The execution was a bit tougher.
My first victim was my Windows 10 Gaming VM. If you want detailed instructions on how I created it, you can check out the post linked above.
I originally tried going the Hyper-V route for my next VM but performance inside Windows 10 tanked significantly the moment I enabled it, forcing me to install VirtualBox.
After installing VirtualBox, I downloaded a Windows 8.1 ISO from Microsoft and created a new VM.
I gave this VM around half of the resources of Windows 10, making sure to also enable nested AMD-V. After a painfully nit-picky installation (thanks Microsoft), I was finally able to boot Windows 8.1.
General performance was OK-ish and the VM was definitely usable. However, networking was unfathomably slow, peaking at around 0.8MB/s.
Luckily, VirtualBox provides easy folder sharing between hosts and guests, so all I had to do was download any needed files on Windows 10 and pass them through to Windows 8.1.
After installing VirtualBox once again, it was time for the third VM.
This is where things started to get a bit annoying. As you might know, Microsoft has dropped support for Windows 7, so finding an ISO was a bit more difficult. Luckily, with a bit of google-fu, I found a website that hosted a direct download link.
While configuring the VM, I noticed that I could no longer enable nested AMD-V. Uh-oh.
Staying optimistic, I pressed forward and started the Windows 7 installation. I quickly realized that this challenge was a lot harder than I originally expected.
The installation took a total of 4 painfully slow hours, ending with a blue screen of death right after the installer tried to reboot the VM. All hope was not yet lost though.
I restarted the VM, and after a one-hour-long boot process (I am not joking), I was greeted with the Windows 7 desktop. Even though the VM booted, the user interface felt beyond sluggish, with every click taking several seconds to register, and animations tearing up the whole screen.
However, this didn't stop me and my hubris. I installed VirtualBox again.
My next target was Windows XP. I deliberately skipped Vista because I was too scared of the performance impact it would have. After downloading a dodgy Windows XP ISO, I created a new VM inside VirtualBox.
This is where I started to realize that my
insanity experiment would soon come to an end. Almost all options, including multiple cores and hardware acceleration, were greyed-out.
Despite that, I still tried to create a VM. After configuring the available options, I started the Windows XP installation. Sadly, after another hour, I was greeted with an error message saying that AMD-V was not available.
In the end, I managed to create a measly 2 nested VMs before being stopped by VirtualBox limitations.
I'm guessing that by using the more efficient KVM platform I would be able to nest at least 3, possibly 4 VMs. However, that is an experiment for another time.
What did I learn from this experience? Absolutely nothing, other than that I am really good at finding ways to procrastinate.