I sprinkle binary bits on my alphabits

The cyberlife and times of Kayhan B, digital librarian extraordinaire, photographer, filmmaker, podcaster and all around nice guy



Ultimate Guide to Virtualization - Part 1 - What is Virtualization (VZ) and What are Virtual Machines (VMs)?

Welcome to my series of articles and tutorials on virtualization and virtual machines. In part 1, I will describe what is virtualization and what are virtual machines, and detail many of the benefits of virtualization and virtual machines as well as some of the drawbacks. From here on in, and for the sake of simplicity, I will refer to virtualization as VZ and a virtual machine as a VM (and VMs when the plural form is used). Sometimes I will use the long form, but most of the time (and especially later on in this article and series), I will refer to both of these using their short form acronyms.

What is virtualization??

Wikipedia gives us a nice, concise definition of VZ.

“In computing, virtualization or virtualisation … is the act of creating a virtual (rather than actual) version of something at the same abstraction level, including virtual computer hardware platforms, storage devices, and computer network resources”

So in essence, what we are doing when we are virtualizing a computer is creating a “virtual” version of the hardware but really at the software level. In other words, we’re emulating the hardware, typically the CPU, network card, etc. That said, there have been some very interesting developments in the world of VZ lately which will be demonstrated later on in this series, that being PCIe hardware passthrough (the ability to passthrough real computer hardware to our VMs most notably GPUs or graphics cards). With this method, we can even passthrough USB controllers for full plug-and-play functionality in our VMs. We can now also do host-passthrough on the CPU, meaning that the CPU is shared identically between your host operating system (the OS doing the virtualizing) and the guest (the OS being virtualized). It is now possible to create and run VMs using these methods of hardware passthrough that make our VMs perform almost at 100% bare metal speed and performance, such as when we install an operating system like Windows or Linux directly onto our systems. The old stereotypes of VMs being slow and clunky are now long gone. Next, let’s look at some of the benefits of running VMs

What are the benefits of virtualization and virtual machines?

The benefits of VZ/VMs are plentiful. These include:

  • The ability to simultaneously run more than one VM / operating system (OS) at the same time. If you’re a Mac user and would like to run Windows using a tool like Virtualbox, Parallels or VMWare Fusion to bridge the gap by running Windows specific applications (eg. tax software), this is possible (and has been for a long while)

  • Centralize your VMs on the network level. In my case, I use multiple computers in my household (mainly Linux based). By installing just one copy of Windows 10/11 on something like Proxmox (a server based virtualization solution), I can access this one copy of Windows from any computer. The real advantage to this is installing software and/or drivers such as scanner and/or printer software. You can install this software on one VM instance, and then be able to access it throughout your household. It keeps things tidy, simplified and easy since you won’t have to deal with configuration on multiple systems. A solution like this relies on not only VZ and VMs, but also remote desktop. In this Proxmox example, you would create a VM, and then remote desktop into your instance

  • Allows you to run multiple VMs / operating systems without having to resort to complicated partitioning schemes. While UEFI/GPT file systems allow for more than four partitions (unlike previously the case with legacy MBR systems), you avoid the need for having a complicated EFI setup and dozens of partitions each pointing to a different OS on your system. Dual booting is also a thing of the past. Distro hoppers (a term used for Linux users who hop from one distro to another) can take full advantage of VZ by testing out multiple distros all under one roof. It is the best of all worlds

  • Isolation. This is an important and inherent security advantage of VMs. Typically, anything you do inside of a VM stays inside of the VM without affecting your host OS. So, for example, if your Windows VM gets some malware, a virus or a rootkit, it would not affect your surrounding host OS. If you have a proper snapshot or backup of your VM (explained in next section), then you can be back up and running again in no time (unlike trying to remove malicious software off of your main system). This alone is one of the strongest use cases for VZ and VMs

  • Allows for easy management of snapshots and backups. A snapshot is basically, well, a “snapshot” of the current state of a VM. It saves disk space as it allows you to capture the running state of the VM, but if you install an update or driver that borks your system or renders it unbootable, it’s easy to roll back to a previous snapshot. Backups are equally as easy. The virtual disk of a VM is basically a file, albeit a very big one (eg. qcow2, raw, vmdk). You can easily back up this file or the entire folder structure of a VM to an external hard drive for safe keeping, in case you ever need to go back in time. This is particularly useful for Mac based VMs. An update to macOS can very easily break the system if using something like OpenCore (although in my experience, OpenCore has been very rock solid, but sometimes in order to update macOS, you must update OpenCore which can be tedious)

  • Cost efficiency. Modern computers are very powerful and typically overkill to run just one OS. If you have a need to run a development environment in Linux for work all the while wanting to do some gaming in Windows, this is possible with VZ. You won’t have to have two (or more) seperate computers. Modern computers are also built with virtualization in mind. Both Intel and AMD have virtualization layers built right into their CPUs that take full advantage of multi-threading. For example, a CPU with 8 cores and 16 threads show up in Proxmox as having 16 processors

There are a few drawbacks to VZ/VMs. These include:

  • Can be complex to setup, particularly if you’re wanting to go the PCIe hardware passthrough route with your GPU. Currently only Linux supports full use of PCIe hardware passthrough, and to some limited extent, Hyper-V on Windows. Linux is the better option for your host computer, which means a learning curve for many folks who’ve never used Linux before

  • Can be expensive. The last point I made in the benefits section, while true, allows you to create one machine to “rule them all” and run multiple VMs, thus negating the need for several computers. That said, the initial investment can be somewhat costly if you want an “all-in-one” type of setup. You’ll need lots of RAM (ideally 64 GB and up if you want a setup like mine), 2 or more GPUs, fast and large NVME SSDs (at least 1 GB to store your host and have room for multiple VMs) and more. So while still cheaper than purchasing or building/running several computers (let’s not forget power draw and AC power requirements), the initial setup can be costly

  • Will require more of your attention. Keep in mind that you will be running multiple OS setups, which means more of your attention will be required for keeping them running properly, updated with security patches, etc. If you’re running, let’s say, a copy of Windows at the network level via something like Proxmox, you’ll need to ensure that your VM is always updated and patched to prevent malicious activity (and apply any necessary virus and malware scanning)

So as you can see, while there are some things to consider with VZ and hosting VMs, the pros considerably outweigh the cons. And let’s face it…running multiple OSs is just cool and nerdy (and you’ll have lots of bragging rights within your circle of friends).

The next article in the series will discuss the different types of hypervisors, the technology used to suport VZ. From there. we’ll continue with a glossary of terms you’ll come across when you first venture into VZ (trust me, there are LOTS of confusing terms so they’ll all need to be defined). After that, we’ll proceed to the how-to articles starting with Proxmox and then a solution that you can use to run Linux, Windows and macOS all at near bare metal speed and all running simultaneously. In this last setup specifically, we will learn how to do PCIe hardware passthrough so that we can game while running other processes

Sources:

https://en.wikipedia.org/wiki/Virtualization