Authors Top

If you have a few years of experience in the Linux ecosystem, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

1. Overview

A virtual machine is virtualization software that we can use to run operating systems without the need to install them on bare metal. During the setup of a new operating system, the virtual machine will prompt us to select the type of virtual disk image to use.

In this article, we’ll cover the virtual disks offered by virtual machines, such as VirtualBox, that we can use to store data. We’ll provide a basic overview and the pros and cons of each virtual disk type.

Afterward, we’ll discuss choosing the correct virtual disk format for the scenarios they are best suited for.

2. What Is a Virtual Disk Image

As the name suggests, a virtual disk image (VDI) is a replica of a portion of the actual hard disk. Apart from being a sector-by-sector copy of an HDD, it also consists of the complete contents and data structure of a physical hard disk.

The virtual disk images are regular files. Virtual machines will treat an image file as a container. They will read and write data to this container — separating it from the host operating system. Our guest operating system and the user data are stored in these containers. Therefore, we can take these virtual disk images to other machines, and they will work on a compatible virtual machine.

Moreover, there are lots of virtual disk images that are offered by virtual machines, such as VMDK, VHD, VDI, QCOW, and QED. In the next section, we’ll go over these VDIs and see how they differ from one another.

3. Virtual Disk Images

3.1. VMDK

VMDK (Virtual Machine Disk) is a type of virtual disk introduced by VMWare specifically for VMWare products. As of 2011, it’s now an open format and is used by other virtual machines as well.

The VMDK disk image allows for dynamically allocated storage. We specify a maximum size for the image from the outset. The physical disk space is allocated or deallocated as we read-write data to the image, making it a very space-efficient format.

In contrast to the dynamically allocated storage, it also supports fixed allocated storage. Fixed disks allocate the specified space in the physical hard disk. It’s been shown unofficially that fixed-size disks perform slightly faster than dynamic-size disks.

Apart from this, the VMKD format has the additional capability of splitting the image into smaller files. For that reason, we can create larger disk images if the file system has a limit on the file size.

Additionally, VMDK has a storage capacity of 62 TB. Not only that, VMDK is known to perform significantly faster than all the other VDIs.

3.2. VDI

VDI stands for VirtualBox Disk Image. It’s Oracle’s default disk image format used by VirtualBox. Similar to VMDK, this image format isn’t specific to VirtualBox and can be used by other compatible virtual machines like VMWare and Microsoft VHD/VHDX.

Like VMDK, VDI is also a portable disk image format and supports both fixed and dynamic storage allocation. Unlike VMDK, VDI doesn’t support incremental backups. However, it provides high-level data redundancy, which decreases the chances of losing data.

VDI has a storage capacity of 2 TB, making it at a disadvantage against VMDK.

3.3. VHD and VHDX

VHD (Virtual Hard Disk) and VHDX (Virtual Hard Disk Extended) are disk image formats owned by Microsoft. VHD was specifically developed for the Microsoft Hyper-V hypervisor. As of 2012, it has been replaced by the modern and feature-rich VHDX.

Similar to VMDK and VDI, VHD and VHDX also reside on the physical hard disks as regular files. Besides dynamic and fixed allocated storage, VHD and VHDX also support differencing hard disk image. DHDI keeps the changes in a child image inside the VHD — allowing the possibility of undoing or merging the changes into the VHD.

Additionally, a VHD image can also be a pass-through disk image. A pass-through disk image is linked to the physical hard disk. For instance, we can mount a VHD disk on a physical partition.

Moreover, VHDX performs slightly faster than VDI and has a storage capacity of 64 TB.

3.4. QCOW and QED

QCOW stands for QEMU Copy-On-Write. It’s the default light disk image format for the QEMU. It consists of three different versions: qcow, qcow2, and qcow3. QED was supposed to be an upgraded replacement for qcow2, but it was abandoned by the QEMU team, and they advise against using this format.

QCOW supports only dynamic allocated storage. Additionally, the recent version of QCOW is much more performant than the previous versions.

4. Choosing the Right VDI

After going through these different disk image formats, we might have a better idea of choosing the proper disk image format now. In practice, we should always aim for something that’s more reliable and faster. With that in mind, VMDK sounds like a superior choice overall.

VMDK has all the features that we might need. It performs faster, provides incremental backups, and supports a huge storage capacity. Most importantly, we can use it on the most popular virtual machines.

However, if we’re using QEMU or QCOW, we might go for QCOW because it’s tightly integrated with QEMU. Similarly, we can also use VHDX if we’re on Microsoft Windows and need features like pass-through disk images.

5. Conclusion

In this article, we briefly looked at what a virtual disk image is and why we need it. Then, we discussed the different types of virtual disk images, such as VMDK, VDI, VHD, VHDX, and QCOW.

Finally, we briefly discussed choosing the right VDI for our purpose.

Authors Bottom

If you have a few years of experience in the Linux ecosystem, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

Comments are closed on this article!