Hypervisor Essentials

Postgraduate in Communications Engineering with working experience in the Support Desk and self-study in software development.
Search for a command to run...

Postgraduate in Communications Engineering with working experience in the Support Desk and self-study in software development.
Oracle VirtualBox is a powerful, open-source, cross-platform virtualization software. It allows users to run multiple operating systems simultaneously on a single physical machine. This capability is extremely useful in various domains, including Dev...
The git log command is used to view the commit history of a Git repository. You can customize the output format to show specific details in a more readable or structured way. Below are some useful variations and formatting options for git log: To sh...

Overview This article will teach us how to: Install Ubuntu Server 24.04 on a laptop from scratch Install Ubuntu server by using Vagrant tool with ISO image Prerequisites: A laptop without any OS installed; A virtualization software Virtualbox t...

The /etc/passwd and /etc/shadow files are the backbone of Linux user management. Together, they store user account information and handle authentication securely. This article provides a hands-on guide to understanding these files, their structure, a...

In Linux, links are powerful tools that allow you to create references to files and directories. There are two main types of links: hard links and soft links (also known as symbolic links or symlinks). Understanding the differences between these two ...

A hostname is a human-friendly name given to a computer. It is a unique identifier that allows us to identify the machine in various network communications, making it easier to locate and manage devices. Type: hostname To see where it is stored, typ...

A hypervisor is software that you can use to run multiple virtual machines on a single physical machine. Every virtual machine has its operating system and applications.
Hypervisor software is installed on physical servers and it loads the virtual machine images to create multiple virtual operating systems. The physical machine is known as a host, and the virtual operating systems are guests.
The hypervisor ensures that each virtual machine receives the allocated resources as configured. It does so by acting as an intermediary between guest machines and the underlying physical hardware. The hypervisor relays requests for processing power, memory, storage, and other resources to the host machine in several ways, including API calls. An API is a software communication method that allows different applications to exchange data.
There are two types of hypervisors, each differing in architecture and performance.

Image credits: IBM
The type 1 hypervisor (also known as a bare-metal hypervisor) sits on top of the metal server and has direct access to the hardware resources. It acts as a lightweight operating system.
Due to its architecture, the type 1 hypervisor is very efficient. It can directly manage and allocate resources for multiple virtual machines without going through the host operating system. These types of hypervisors are also more secure, as the absence of a host operating system reduces the risks of instability.
The type 2 hypervisor (also known as a hosted or embedded hypervisor) is a hypervisor program installed on a host operating system. Like other software applications, hosted hypervisors do not have complete control of the computer resources. Instead, the system administrator allocates the resources for the hosted hypervisor, which it distributes to the virtual machines.
The presence of the host operating system introduces latency to the virtualized environment. When the virtual machine requests computing resources, the hypervisor cannot directly access the underlying hardware but relays the request to the host operating system. Also, the hypervisor and its hosted virtual machines are dependent on the stability of the host operating system.
Hyper-V hypervisor is Microsoft’s hypervisor designed for use on Windows systems.
Citrix hypervisors (XenServer) is a commercial Type 1 hypervisor that supports Linux and Windows operating systems.
Hypervisor KVM is a kernel-based Virtual Machine (KVM) (open source virtualization) technology built into Linux®. It is part of Linux*. It* converts Linux into a type-1 (bare-metal) hypervisor.
In full virtualization, the hypervisor completely emulates hardware for the guest OS. This means the guest OS interacts with what it perceives as physical hardware, but it's a software emulation provided by the hypervisor.
When the guest OS makes a system call or accesses hardware resources, the hypervisor intercepts these calls and emulates the response of the hardware, without the guest OS knowing about this intermediation by using a combination of binary translation and direct execution techniques. This approach, depicted in the Image below, translates the guest OS kernel code dynamically to replace nonvirtualizable (sensitive) instructions for direct access to the hardware with new instructions that are safe to execute in a virtual environment and produce the same end effect on the virtual hardware as the original instructions would have had on physical hardware. Meanwhile, user-level code is directly executed on the processor for high-performance virtualization. Each virtual machine monitor provides each Virtual Machine with all the services of the physical system, including a virtual BIOS, virtual devices, and virtualized memory management.

The hypervisor translates all operating system instructions on the fly and caches the results for future use, while user-level instructions run unmodified at native speed.
Full virtualization offers the best isolation and security for virtual machines and simplifies migration and portability as the same guest OS instance can run virtualized or on native hardware
Paravirtualization refers to communication between the guest OS and the hypervisor to improve performance and efficiency. Paravirtualization, as shown in the Figure below, involves modifying the OS kernel to replace nonvirtualizable instructions with hypercalls that communicate directly with the virtualization layer hypervisor. The hypervisor also provides hypercall interfaces for other critical kernel operations such as memory management, interrupt handling and timekeeping.

As paravirtualization cannot support unmodified operating systems (e.g. Windows 2000/XP), its compatibility and portability are poor.
This hands-on lab focuses on creating a CentOS7 virtual machine via Oracle VirtualBox on Ubuntu OS 22.04.03
Ubuntu OS 22.04.03
Installed Oracle VirtualBox
Click New in the VirtualBox Manager window for setting up a new virtual machine (VM).

Use the Create Virtual Machine: Memory Size wizard to select the amount of RAM that Oracle VM VirtualBox should allocate every time the virtual machine is started.

The amount of memory selected here will be taken away from your host machine and presented to the guest OS, which will report this size as the virtual machine's installed RAM.
Use the Create Virtual Machine: Hard Disk to specify a virtual hard disk for the virtual machine.

The following fields are available on this wizard page:
Create a Virtual Hard Disk Now. Creates a new empty virtual hard disk image, located in the VM's machine folder.
Use an Existing Hard Disk File. Enables you to select an existing disk image file to use with the new VM.
Do Not Add a Virtual Hard Disk. The new VM is created without a hard disk.
Use the Create Virtual Hard Disk: Hard Disk File Type to select a file type for the new virtual hard disk image.

Oracle VM VirtualBox supports the following types of disk image files:
VDI. Normally, Oracle VM VirtualBox uses its own container format for guest hard disks. This is called a Virtual Disk Image (VDI) file. This format is used when you create a new virtual machine with a new disk.
VHD. Oracle VM VirtualBox also fully supports the VHD format used by Microsoft.
VMDK. Oracle VM VirtualBox also fully supports the popular and open VMDK container format that is used by many other virtualization products, such as VMware.
Use the Create Virtual Hard Disk: Storage on Physical Hard Disk page to select whether the size of the virtual hard disk file is dynamically allocated or is of fixed size.

Use the File Location and Size page to configure the location of the virtual hard disk file and use the slider to set the size limit for the virtual hard disk.

The virtual hard disk image is created in the specified location and added to the Hard Disks tab in Virtual Media Manager.
Before running the new virtual machine, go to "Settings" > "System" > "Motherboard" > "Pointing Device" > "USB Tablet":

Oracle VM VirtualBox provides a virtual USB tablet device to new virtual machines through which mouse events are communicated to the guest OS.
Otherwise, if the virtual machine detects only standard PS/2 mouse and keyboard devices, since the OS in the virtual machine does not know that it is not running on a real computer, it expects to have exclusive control over your keyboard and mouse. But unless you are running the VM in full screen mode, your VM needs to share keyboard and mouse with other applications and possibly other VMs on your host.
When you start a VM for the first time the OS installation process is started automatically, using the ISO image file specified in the Create Virtual Machine wizard.
If the ISO image file was not specified, select your VM in VirtualBox and click "Settings".
Go to "Storage" > "Controller: SATA" > "Empty".
Click on the disk icon next to "Optical Drive" and select "Choose a disk file". Locate and select the downloaded CentOS 7 ISO .

Follow the onscreen instructions to install your OS.
After the installation process, before rebooting the VM, go and click "Devices" > "Optical drivers" > "Remove disk from optical drive"
If you have scaled mode enabled, then the virtual machine's screen will be scaled to the size of the window.
To enable scaled mode, press Host key + C, or select Scaled Mode from the View menu in the VM window. To leave scaled mode, press Host key + C again.

This can be useful if you have many machines running and want to have a look at one of them while it is running in the background. Alternatively, it might be useful to enlarge a window if the VM's output screen is very small, for example because you are running an old OS in it.