Different Disk Image types
in virtualization
(VDI, VMDK, VHD, VHDX)
Disk images exists in the host operating system and are created by carving out the host operating system’s available excess hardware. To the guest operating system, these hard drives appear as physical hard disks of a certain sizes. (Defined by the user)
When you write data to or read data from a hard drive, the hypervisor you use will redirect the request to the said image file. It can be a type I or a type II hypervisor. The process is the same.
Hypervisor is a technology used to create virtual machines on top of a host OS. Multiple OSs can be installed on a single host using a hypervisor. And the hardware these VMs need will be borrowed from the host OS. This process is managed by the Hypervisor.
There are two types of Hypervisors
Type 1 Vs. Type 2 Hypervisors
Type I hypervisor —
This is a purpose built bare minimum OS to be installed on a regular PC or preferably a server to be used as a host for guest virtual machines. Unlike a regular Operating system, this OS’s only job is to share and manage resources with guest VMs from the host computer’s hardware as efficiently as possible. This OS does not have any other responsibility, hence it’s very lean. (Small in size). Does not consist of a GUI (Headless), instead it provides you a web interface to manage your VMs with. This is the industry standard for virtualization today. In enterprise environments, multiple servers run as VMs in one bare-metal server (vSphere ESXI) and in addition to that one bare-metal production server, one or two servers (ESXI vSpheres) will run parallelly to that to add redundancy (And high availability) thus lowering the initial hardware cost, real state and power consumption. VM migration and management between servers can be done very easily by using the vCenter dashboard. That is the proprietary web application used to manage multiple ESXI instances in a single production environment.
(Ex — VMware ESXI, Proxmox)
Dell and VMware has come up with a server line up that has type I hypervisors pre-engineered into them (ESXI). This server line up is called Dell EMC VXRail. This technology let’s us manage our on-premises infrastructure and cloud infrastructure with one tool called VMware Cloud Foundation. The beauty of this is that we don’t have to learn different technologies like Azure, AWS or GCP. They all have a different environment which you have to master. They all have different courses as well. But with VMware Cloud Foundation, Cloud and on-prem infrastructure will be managed by the same VMware tools. Which makes the life of System Administrators very convenient.
Type II hypervisor —
This is a software that is designed to run on top of a regular OS (Ex — Windows, Linux, Mac OS) as a host for the VMs. It’s job is to talk to the host operating system and share it’s recourses with the VMs that is installed on top of the host OS using the virtualization application.
(Ex — VMware workstation, Oracle VirtualBox)
Deep dive into Virtual Hard Disks
Like a physical hard disk, a virtual disk also has a size or a capacity. The difference between a physical hard disk and a virtual disk is that, in a virtual disk, you can change the size of a virtual disk after its creation. Even if you have data in it. With physical disks, you’re not able to do that.
And virtual hard disk types can be formatted using the same file systems as physical hard disks. As such you can even encrypt disks if the files system supports disk encryption. (Ex — NTFS)
It’s very easy to create or delete a virtual hard disk regardless of the disk type you intend to use. And they are portable and easy to migrate among servers thus increasing the redundancy and high availability.
One disadvantage of a Virtual hard Disk is that, they’re relatively slow compared to physical hard disks. Specially if you create those VMs on a mechanical hard drive instead of an Solid State Drive (SSD). This happens because of the overhead associated with them. One other reason for slow performance in virtual hard disks is that, too many snap shots associated with a VM.
Virtual Disk Formats
Now that you know what’s a Virtual Disk is, it’s important to know the kind of virtual disk types that is available in the world of virtualization. In here, I will be talking about the most common virtual disk types, you’ll encounter in the industry.
Virtual Machine Disk (VMDK) — This is a Open Container type that is very commonly used by all the major virtualization platforms including VMware. In any hypervisor, it is good to choose this file type (VMDK) if you need inter-operability among different virtualization platforms.
Virtual Disk image (VDI) — The default container type used in the oracle VirtualBox type II hypervisor. This is the file type that’s selected by default by the hypervisor to create a virtual disk.
Virtual Hard Disk (VHD) — This is a container type used by Microsoft and Critix
Virtual Hard Disk (VHDX) — This is a container type also used by Microsoft
How to provision a virtual hard disk?
There are three ways in which you can do this.
- Thin Provisioning (Dynamically Allocated) -
A dynamically expanding virtual hard disk initially consumes a very small amount of space at the time of it’s creation. Typically less than 1GB. As an example a dynamically created 100GB hard disk will initially consume about 5GB of space, but then it will grow gradually as the user adds more and more data into it. But it will stop growing when it hits 100GB in size. Because that’s the disk size that is configured by the user at the time of it’s creation.
2. Thick provisioning (Fixed size) -
This classification claims the amount of drive space defined by the user at the time of the drive’s creation. That space will be claimed by the virtual disk and it won’t change the size after it’s creation. As an example, 100GB fixed size virtual disk will consumed exactly 100GB of space in the physical hard disk’s space.
3. Differencing -
A hard disk that has a parent child relationship with another virtual disk or physical disk. Differencing disks are most commonly used in the creation of snapshots, which are point-in-time representations of a virtual disk file. Virtualization management software uses a differencing disk to track changes made to a base virtual hard disk file.
Conclusion
Before virtualization was a thing, we had to run different servers for different purposes and that costs us a lot in the initial investment for hardware and in the long run for utility bills. But we are able to run multiple virtual machines in one server as per the requirements. But now there is a new technology called “Containers”. This technology takes us back to the age of not having type I hypervisors. It’s fast and reliable due to it’s deployment methods and they’re deployed on top of a host Operating System. Developers love it because they all can deal with the same container in development and testing as well as in deployment. As of 2022, we’re using both Docker Containers and virtualization to run production environments both on-site and in the cloud. If you’re in IT, it is essential to learn these things as they’re the current trend.