What is virtualization?
Virtualization uses software to simulate and partition hardware environments — allowing us to run applications more flexibly and efficiently on a given machine.
The groundwork for virtualization technology was laid in the 1960s and 70s. Engineers at companies like IBM sought to more efficiently utilize mainframe resources, so that a single computer could serve multiple users or complete multiple tasks simultaneously.
By the 21st century, virtualization reached the data center. While our use cases for the technique are more diverse than ever, the benefits of virtualization today aren’t so fundamentally different from those in the mainframe days: we are able to more efficiently and flexibly utilize our compute resources, reducing costs and getting more out of our overhead investments.
How does virtualization work?
Virtualization works by introducing an additional layer of software called a hypervisor into the hardware and software stack. There are two different types of hypervisor, and its location in the software hierarchy depends on which type you’re using.
A bare-metal hypervisor (also known as type 1) is sandwiched between the hardware and the operating system (OS). This gives the hypervisor privileges usually restricted to the OS, such as provisioning memory and processor capacity.
With this type of hypervisor, you can partition a system to run multiple operating systems, each of which might be set up to run simultaneous processes with very different dependencies.
Imagine, for example, that you were running a web server and an email server on two different machines, each of which required distinct configurations — but used only a quarter of the compute resources available on their dedicated hardware.
Instead, you could use a Type 1 hypervisor to create two virtual machines on a single piece of hardware, utilizing 50% of its capacity and eliminating the need for a second physical machine altogether.
By contrast, a hosted hypervisor (also called type-2) is installed within an existing OS. Many users may be familiar with software such as VirtualBox or Parallels that allow you to run a second operating system within your primary OS, as if it were just another program — a Linux distribution within Windows, say, or Windows within macOS.
Hosted hypervisors can be especially useful for users wishing to test code in a different environment, isolate a particular application, or run software not available on their platform.
Bare metal hypervisors, on the other hand, open up a wide range of possibilities at the server level. Indeed, since 2006, the introduction of Kernel-based Virtual Machine (KVM) technology in the Linux kernel has meant that Linux installations may be easily adapted into hypervisors, making the technology easy to implement for IT administrators.
Types of virtualization
Today, there are five major types of virtualization employed by enterprises and end-users:
- Server virtualization – Virtualized servers can utilize compute resources more efficiently — and can be deployed much more flexibly than servers bound to dedicated hardware.
- Data virtualization – When data is virtualized, applications can parse, utilize, and synthesize information from many different sources and formats.
- Network functions virtualization – Simulating a physical network allows network-native applications to run with all the benefits of virtualization, and without the complexities introduced by more numerous physical requirements.
- Desktop virtualization – Virtualized desktops allow organizations to provide users with interfaces that aren’t constrained by available hardware — for example, field employees might access PC desktop applications through a virtual desktop made available on a mobile device.
- Operating system virtualization – As in the discussion of hypervisors above, virtualizing an OS allows multiple operating systems to run side by side, or for users to run one OS within another.
Though these approaches to virtualization vary widely in their technologies and use cases, they provide many of the same underlying benefits.
Benefits of virtualization
Whatever approach to virtualization you take, you can expect to reduce costs dramatically over using traditional, dedicated hardware. As we’ve seen, virtual machines can reduce compute overhead, thereby bringing down prices and even energy demands.
In addition to cost reductions, virtual machines — which can be “stored” in a single file — can simplify deployment to the cloud, allowing you to deploy an isolated, single-purpose VM with the appropriate OS and dependencies, all bundled together. And if a virtual machine crashes, you can simply deploy a new one from the same file, minimizing or eliminating downtime.
Today, the question for enterprises is not whether to take advantage of virtualization — instead, forward-looking organizations are asking how to go about deploying and coordinating virtualized resources, when to use virtualization versus containerization, and which cloud services best suit the organization’s purposes. If you’re navigating these questions now, Mirantis’ Total Cost of Ownership Calculator can help you compare projected costs for implementing a given number of VMs over four years using either Amazon Web Services (AWS) or OpenStack.
How to use virtualization
If you’re interested in experimenting with virtualization right now, you can try using VirtualBox to create a VM on the machine you’re using right now — for instance, you might run Ubuntu within your current operating system. VirtualBox is freely available open source software from Oracle that runs on Windows, Mac, and Linux, and allows you to virtualize a wide range of contemporary and legacy operating systems.
Note: to follow this short guide, your system should have at least 8GB of RAM and 15GB of free hard drive space. If you are on a Mac, you will also need to “Allow” VirtualBox system permissions in the Security and Privacy tab of your Mac System Preferences menu. You will need to do this immediately after installing and running VirtualBox for the first time.
To get started, visit the VirtualBox downloads page and choose the latest build for your platform, then open the file and follow the instructions in the installer.
Once VirtualBox is set up, you’ll need an OS “image” to load — this is typically a file with an .iso extension. Let’s use the latest Long-Term Support (LTS) version of Ubuntu Desktop, available from Canonical here. Note that the .iso file for version 20.04.03 (the most current at the time of writing) requires about 3GB.
Once you’ve downloaded the .iso, open VirtualBox. On the main screen of the VirtualBox Manager, select “Add.”
Here, you will need to choose a name for your new VM, a destination folder, and the type and version for the OS you will be running. For this exercise, select “Linux” for the type and “Ubuntu (64-bit)” for the version. Click “Continue.”
Next, you will need to specify how much of your physical memory the virtual machine may use. Ubuntu Desktop requires 4GB of RAM, so let’s assign 4096MB to this experimental VM.
On the next screens, you’ll make several choices about the configuration of your VM’s hard disk. Choose “Create a virtual hard disk now,” then the “VDI” file type.
Choose Dynamically allocated storage, which means that the drive will only take up as much space as it actually needs, even if it’s specified as larger.
Finally, you’ll need to choose the limit on physical hard drive space allowed to the virtual machine. Select 10GB and click “Create.”
Now we’ve created our Virtual Machine and we can see it in the VirtualBox Manager! To get it up and running, we have just one more step — we need to point the virtual machine toward the Ubuntu .iso file for its initial installation. Under “Storage,” beside “IDE Secondary Device 0,” click on “[Optical Drive] Empty” and select your .iso file.
Now you’re ready to boot up the Virtual Machine! You can click “Start” or double click the name of your VM in the left-hand pane. If everything is working properly, a new window will open and your guest OS — in this case, Ubuntu — will begin to boot up inside.
Once Ubuntu is set up on the virtual machine, you can use it as you would a fresh installation, all in its own window within your normal OS. For more information on setting up an Ubuntu VM — and configuring it to serve as a full-fledged Kubernetes development environment — visit our Kubernetes Lab tutorial.
When you’re done using the VM, you can turn it off just like a physical machine — and boot it back up when you’re ready to resume your work on the VM.