7 virtual machine mistakes to avoid
I’ve been running virtual machines for nearly 20 years at this point, and I’ve made a lot of mistakes along the way. From incorrect RAM allocation to forgetting to unmount the installation ISO, I’ve broken stuff on my journey. Here are seven mistakes I made that you should definitely avoid.
I didn’t allocate enough RAM (then I allocated too much)
When I first started working with virtual machines, I simply didn’t understand RAM allocation. Sure, some ultra-lightweight Linux operating systems can run on 512MB of RAM, but good luck running Windows on that—but that’s still what I tried to do.
The first computer I had to run virtual machines on only had 8GB of RAM, and I wanted to keep as much as possible for the host, so I tried to run VMs with around 1-2GB of RAM, and that is not ideal. After that, I tried to allocate too much RAM, and that equally didn’t work well.
These days, it’s a balancing act for how much RAM I have allocated to a virtual machine. I try to semi-frequently check the actual RAM usage of a VM and tailor the allocated RAM to be slightly more than it’s using so there’s room above it, but also not over-allocated so that way I have enough resources to spin up more VMs down the road.
I made the boot drive too small and had to expand it later
Similar to RAM, I had a small drive on my first computer that I ran virtual machines on. It was a Gateway laptop with a first generation i3 processor and a 1TB SSHD—a hybrid SSD and hard drive that had 8GB of flash storage and 1TB of traditional spinning rust.
While 1TB is a decent amount of storage for a laptop, I had a lot of files on the computer for Android development back in the day. Because of this—and the fact I was trying to run several different virtual machines on my anemic laptop—I tried allocating small storage drives to my virtual machines.
The problem became clear when I ran out of space quickly and then had to expand the drives later. Thankfully, expanding a virtual machine disk is not the most difficult task in the world. But, it still required me to do quite a few steps to first expand the vdisk for the virtual machine, then expand the operating system to properly see the additional storage.
I forgot to unmount the installation ISO
I just started up a new virtual machine today and forgot to unmount the installation ISO. After you install an operating system, you’re supposed to unmount the installer disk—whether that’s removing an installer DVD, flash drive, or unmounting an ISO from the virtual machine. If you don’t unmount the ISO after installing, Linux will complain until you do. Windows, surprisingly, is fairly fine with this, but Linux has a fit.
This is such a simple step, but it’s also super easy to miss. If your virtual machine isn’t booting after install, check to make sure that the install ISO has been unmounted.
I chose the wrong OS type
Something that I didn’t realize early on in my virtualization journey was that you had to specify what type of operating system you plan to run in the virtual machine. The reason for this is the hypervisor (VirtualBox in this instance) needs to know how best to present the virtualized hardware to the operating system. Windows and Linux expect to see it differently.
Since I didn’t know that this mattered, one time I tried installing Windows without changing the operating system to Microsoft, and the system simply failed to boot. I troubleshot the virtual machine for longer than I’d care to admit before I realized I made such a simple, yet critical mistake.
I didn’t install the guest additions
Almost all virtualization programs include guest additions—including VirtualBox. With guest additions, your virtualization host (so VirtualBox) will be able to better communicate with the virtualized operating system.
These days, I use Proxmox for my virtualization, and installing guest additions for Proxmox allows me to see the IP address of the virtualized guest as well as have better communication from my host to the virtual machine. VirtualBox’s guest additions work in a very similar way, allowing your host (VirtualBox) to access parts of the guest (the virtual machine) that it otherwise couldn’t access.
Some of the extra features enabled in a guest operating system (virtual machine) when guest additions are installed include better mouse pointer integration, shared folders, better video support, time synchronization, a shared clipboard between the host and guest, plus much more.
I assigned too many CPU cores
Just like with RAM, CPU cores play a vital role in your virtual machine experience. Too few CPU cores and the system will simply fail to boot; while too many result in your host operating system choking out.
Your virtual machine will try its best to utilize whatever resources you allocate to it. While modern systems have dozens of threads, that simply wasn’t the case with older computers. If we take a look back at the first generation i3 processor my Gateway laptop had, it only had two cores and four threads. This gave barely anything to allocate to a virtual machine.
I once tried to give a VM three of my four cores, and Windows was not happy with that. The system ended up locking up and crashing, where I edited the virtual machine on next boot to only have one or two cores.
I forgot to enable VT-x/AMD-V in BIOS
Most computers have virtualization enabled by default, but there have definitely been times when Intel’s VT-x or AMD-V wasn’t enabled in BIOS when I tried to run a virtual machine.
This is a one-time setting that you’ll have to change in your computer’s BIOS. It’s not difficult to change, and there’s really no downside to enabling it. In fact, there are only benefits to enabling it if you’re trying to virtualize an operating system in a virtual machine, as a VM simply won’t work if you have it disabled.
Now that you know all the mistakes I’ve made in my journey to run virtual machines, it’s time to pick the right operating system to virtualize. One of my favorite operating systems to virtualize is Ubuntu Server. It runs so great as a VM and gives you the full Linux experience in a terminal. In fact, I have three Ubuntu virtual machines running at this very moment doing various tasks on my VM host.
link
