What is a Virtual Machine?
In our virtual machine guide, we explain everything there is to know about virtual machines in a series of blogs that will grow continuously.
We will explain exactly what VMs are, how they are virtualized, how they run, how they can benefit your business, use cases, cloud virtualization and IaaS, how it works, what the costs are, real life applications, set up, security, and much more.
This is the first installment, where we explain in-depth what a virtual machine is, how it functions, its safety, uses and benefits.
1. What is a virtual machine?
In the simplest terms, a virtual machine (VM) is a virtual copy of a computer. It’s a computer that’s all software, no hardware, at least none of its own. It borrows the hardware resources of the physical computer (aka host) it runs on.
Below you can see an Ubuntu VM running on Windows 10 laptop, a whole new computer inside a computer.
Why would we want this magic?
Before VMs, we were confined to the limits of physical computers. Each computer, like your laptop, could only run a single operating system (OS) like Windows and the OS could not even make full use of the hardware resources available to it.
Computers are resource-inefficient and require one to be physically present to run and manage them. VMs, amazingly, solve all these problems using software called virtualization technology.
How is this virtualization implemented?
Each VM is a fully isolated environment, can run their own OS and function as a self-sufficient entity.
The result is that we can run multiple different operating systems on a single computer or server, and divide and use its resources economically.
We can also run multiple virtual computers, virtual machines, alongside each other, atop a single physical computer or server.
The following analogy might help.
Virtual machines are like flats in a large building. Every flat is an isolated, self-sufficient home for its occupants. Every flat has its own furniture, its own design, and its own appliances, just like a VM has its own operating system and applications.
But every flat depends on the building’s central power, water, and gas supply, just like a VM depends on the host’s hardware resources, like CPU, RAM, network and sound cards etc.
Multiple flats can exist within the same building, and house different families, without any conflicts. Just like a physical host running different operating systems over the same hardware, without resource contention.
2. How does a VM work? The technical nitty-gritty
Now, let’s understand how the virtual machine magic happens, behind the scenes.
All the heavy lifting is done by a special kind of software, known as a hypervisor, aka virtual machine monitor (VMM).
It’s the actual virtualization tool, the entity responsible for creating a virtualized layer over the physical hardware and managing VMs thereafter.
There are two main types of hypervisors, Type-1 and Type-2:
Type-1: bare-metal hypervisors
These hypervisors run directly on and communicate directly with the physical (bare-metal) hardware. They effectively replace the host OS. They are the most common hypervisors and the most secure.
As you can see, every virtual machine has its own guest operating system, its own OS-specific applications, and its own share of virtual hardware resources, allocated by the hypervisor.
Type-1 hypervisors also provide the lowest latency and VM OS speeds close to that of the bare-metal server.
A server is an industrial-sized, enterprise computer housed in data centres around the world. Typically, bare-metal hypervisors are only used on servers, where the sole purpose of these servers is to run virtual machines. Using Type-1 hypervisors on servers is the industry standard.
Hosting providers, like us, buy and host the bare-metal servers, create these VMs with Type-1 hypervisors to provide them as an online service for a small monthly fee.
This service is called infrastructure as a service (IaaS).
The online or on-demand feature of this service is called cloud computing. We’ll explain all this in depth in the second article.
Clients get root access to SSH into their VMs to manage remotely.
Here’s what a newly provisioned Ubuntu virtual machine from HOSTAFRICA looks like.
Here’s a newly provisioned Windows virtual machine from HOSTAFRICA.
Clients connect to their Windows VMs through Remote Desktop Connection
Type-2: hosted hypervisors
These hypervisors run as an application in an existing operating system (OS), just like any other software on a computer. The existing OS is called the host OS, and the OS running in the VM is called the guest OS.
Below you can see a fully functional Ubuntu OS (guest) running alongside the laptop’s native OS Windows 10 (host).
Type-2 hypervisors are typically only used on personal computers. These hosted VMs are convenient if you simply need to run another operating system on your desktop.
This enables instant access between the the host and guest machine to take full advantage of the features you need from each OS simultaneously. Users can cut and paste between host and guest bilaterally.
However, hosted VMs present the following limitations:
- Just like any application, your PC can only handle so many at once. Depending on how much resources your PC has, you will be limited to installing only a handful VMs, and not all will be able to run at the same time.
- Also pertaining to the application nature of VMs, they can only run if your PC is powered on. This can increase your power costs and put “mileage” on your PC resources.
- Your VM is reliant on your PC hardware, which can present latency and subsequent performance issues.
- If your host OS is compromised by a hacker, they would have access to all your guest VMs on it.
If you need always-on access, freedom from your PCs resource limitations, high performance and security, then you need a type 1 VM from a hosting provider like HOSTAFRICA. Our severs run on enterprise hardware so they are incredibly powerful, fast, and secure. Our virtual machines are running and monitored 24/7, and you can access them from wherever you are (cloud hosted).
Another benefit of our Type 1 VMs is that they are virtualized and secured using the latest an greatest software on the market, and constantly updated.
3. Examples of virtual machine software
Most famous type-1 hypervisors:
KVM: Linux KVM is often the go-to choice for type-1 virtualization. KVM is shipped as part of the Linux kernel (more on this in the next section)
Hyper-V: Microsoft Hyper-V can be deemed as the Windows alternative to KVM. Hyper-V has been an optional add-on for Windows Server, since version 2008. There is also a freeware addition, with limited functionality.
ESXi: VMware ESXi is a purpose-built server virtualization software. It has both free and paid versions, with the former not offering central management.
Most famous type-2 hypervisors
As far as type-2 hypervisors go, the following are the most prevalent:
VirtualBox: A very lightweight type-2 hypervisor that can run on Windows, Mac, and Linux. It’s free and open-source.
VMware Workstation: A simplistic version (for non-commercial use) of VMware workstation is available for free. There is also a pro version, which is geared towards enterprise use. Supports Windows, Mac, and Linux.
QEMU: A free and open-source hypervisor that’s a top choice for Linux environments, but also supports Mac and Windows.
4. What is KVM virtualization?
KVM stands for kernel-based Virtual Machine. It is widely regarded as the go-to bare-metal hypervisor. It’s built into Linux, and converts the Linux kernel into a hypervisor.
Linux hypervisor virtualizes the host hardware and allocates a share of these virtual resources to each independent virtual environment. The hypervisor is also responsible for logically isolating each VM, and managing all VMs on the same host.
A great benefit of Linux is the huge active community of developers and vendors that regularly contribute to the advancement of the kernel. KVM is fast and reliable because it’s a part of the Linux kernel (since Linux 2.6.20).
This means that KVM already contains many required OS-level components like memory management, scheduling, I/O, networking, etc. without any performance reduction. It also means KVM instantly gets all new features, fixes and improvements that Linux gets.
The features that make KVM a top choice is enhanced security, lower latency, higher prioritization, live migration (meaning no down time for end users), smart storage, rapid implementation of latest hardware features, inherited Linux memory management, and scaled performance.
That’s why at HOSTAFRICA we use KVM to virtualize and manage our virtual machines.
5. Are VMs safe?
Virtual machines created with Type-1 hypervisors like KVM that run on servers are very safe. The best feature of their virtualization is that they are completely isolated environments. This means that if one VM crashes, or is hacked, the others are unaffected and can continue to deliver.
To explain further, each VM is logically separated from others, and has their own slice of virtual resources. They have all they need to run as a completely independent computer. It’s like whole servers running within a server.
This isolation makes these virtual machines very secure against hackers and malware that spread from one part of your system to eventually infect and take over your entire system, even the hardware.
If one VM is compromised, it’s extremely unlikely a hacker or malware can escape the confines of that VM.
It’s actually why cybersecurity professionals use virtual machines to handle potential malware safely.
If it turns out to be malware, the infection is contained within that VM, and very easy to sanitise compared to physical servers or a local PC. You can simply roll back to a snapshot or restore a backup of your VM from a date when all was in working order.
This is why virtual machines are intrinsically good at disaster recovery. Since virtual machines allow you to easily clone, replicate and back up, services are usually distributed across multiple VMs.
With servers and PCs, however, it’s much easier for a hacker or malware to make their way through your entire system, and even compromise your hardware. Once that happens, it’s almost impossible to sanitise.
6. What is a virtual machine used for?
A virtual machine is capable of doing all the things a physical computer can, only better. In general, they are used to store data, run applications and services, connect resources to the internet, and serve content to the web.
Type 1 VMs on servers
Virtual machines created with Type 1 hypervisors are mostly used on servers for enterprise use. These servers and hosted and maintained by hosting providers.
We provision high performance VMs for the public for their use exclusive individual use. We set up VMs to be on-demand, accessible from anywhere in the world. This is called cloud virtualization and computing.
There is no limit to the number of VMs you can buy, and they are far more cost-effective than physical servers. You get a dedicated server experience for a fraction of the price, and no upfront costs.
Our VMs are used by app developers, IT and cybersecurity professionals, web developers and designers, marketing agencies, business owners, ecommerce store owners, website owners, cloud-based accounting software users, and more.
Modernize businesses operations: Moving your local legacy infrastructure to a cloud VM-based infrastructure in the cloud means employees can access applications, update files, and collaborate from anywhere in the world, in real-time. It also means reliable, fast, and cost-effective web servers, email servers, backup servers, databases, and virtual work environments.
Build quickly scalable infrastructures: A business thrives as well as it can adapt to market demands. Nothing scales as well as virtual machines in today’s fast paced market. All you have to do is specify the operating system, CPU, memory, and network resources, and hit “Spawn”. Provision, deprovision, clone, or migrate, all with a few clicks.
Run multiple operating systems: You may have different clients, or applications with different OS-level dependencies. This is the most relevant use-case for building a VM-based infrastructure.
Whenever you want to on-board a new client, or release an application for a different operating system, all you have to do is spin a new virtual machine.
Host your websites and ecommerce stores: If you are looking to host your websites online, a virtual machine, aka cloud server, has to be your best option. They are far cheaper than bare-metal servers, and are relatively more feature-rich and resilient than containers.
Build performant apps: Website overwhelmed by thousands of new users? No problem. Provision a new virtual machine, and divide the load among the two servers. Or simply increase the CPU and/or memory of your virtual machine, on-the-fly.
Type 2 VMs on PCs
Virtual machines created with a Type 2 hypervisor are normally used by individual PC/Mac users who need to run multiple operating systems.
As each OS offers certain advantages and features, users can now get the best of each OS they need simultaneously on one personal device.
This is called Desktop virtualization, and is a real asset for individual productivity.
They are used by cybersecurity professionals, developers, engineers, and business individuals.
For development and testing: As your developers and engineers explore different libraries or frameworks to build robust software applications, they may feel the need to create testbeds. This is where VMs can come in handy.
Instead of asking your infrastructure team for new resources every time, they can install a type-2 hypervisor on their dev machine, and launch a testbed inside a virtual machine.
Handling malware: VM isolation makes it especially useful for handling potential malware and keeping it contained to the VM, away from your main systems.
7. How can VMs benefit my business?
Virtual machines can benefit your business in more ways than one:
- Flexibility: Let teams across your organization choose their own operating systems, and their own resource specifications. Your IT team may want a Linux virtual machine with multiple network adapters; your accounting team may just make do with a standard Windows virtual machine.
- Cost savings: Virtual machines eliminate the cost of purchasing and managing hardware. Be it on-site, or in the cloud.
- Be cloud-first: Virtualization and virtual machines are built for the cloud. Use them to establish your identity as a cloud-first organization.
- Future-proof your infra: Whether you want a cloud hosting for your websites, or want to build a scalable production infrastructure, virtual machines are your best choice. They will grow as you grow, proving to be a future-proof investment.
- Increased efficiency: Virtual machines are easier to maintain and monitor than physical computers. Add network, memory, or CPU resources to your virtual machines on-the-fly. Doing so isn’t straightforward with dedicated servers, and requires physical access to bare-metal servers.
This concludes Part 1 of our series on virtual machines. We explained what a virtual machine really is, how it works, and how it can be beneficial for different use-cases.
Stay tuned for the next part, which will be on virtual machine cloud hosting.