What is a virtual hard drive?
A virtual hard drive file is a container file that acts similar to a physical hard drive. Like a physical hard drive, a virtual hard drive file contains a file system, and it can contain an operating system, applications and data. Virtual hard drive files are normally attached to virtual machines (VMs), and function as system or data drives for the VM. In some cases, however, virtual hard drive files are used for archival purposes because of the file's portability.
The Windows OS is natively able to mount a VHD- or VHDX-based virtual hard drive file in the same way that any other type of removable media can be mounted and accessed by the operating system.
Types of virtual hard disk file formats
There are a number of different types of virtual hard disks. It's usually possible to differentiate between virtual hard disk types by examining the filename extension. Some of the more common types include:
- Virtual Disk Image (VDI), used by Oracle VirtualBox
- Virtual Machine Disk (VMDK), used by VMware
- Virtual Hard Disk (VHD), used by Microsoft and Citrix
- Virtual Hard Disk (VHDX), used by Microsoft
Some virtual hard disk file formats are supported by multiple vendor products. For example, VDI, VMDK and VHD are all supported by Oracle VirtualBox.
Fixed, dynamic and differencing
There are three main classifications of virtual hard drive files -- fixed, dynamic and differencing. A fixed virtual hard disk file is a file that claims the maximum possible amount of physical disk space at the time of creation. For example, a 100 GB fixed length virtual hard disk file would initially consume 100 GB of physical storage space.
A dynamic or dynamically expanding virtual hard disk initially consumes a very small amount of physical disk space -- typically less than 1 GB -- and grows as data is added to the virtual hard disk. For example, a 100 GB dynamically expanding virtual hard disk might initially consume 5 MB of physical disk space, and then gradually grow in size as data is added.
A differencing virtual hard disk is a virtual 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.
Virtual hard drive uses
Virtual hard drives are most commonly used by VMs to store operating system and application files, as well as data. However, virtual hard disk files are also sometimes used by snapshot tools, backup applications and archival products. Hyper-V and VMware both use snapshots -- and differencing disks -- to capture the state of a VM. Some backup applications have an instant recovery feature that uses snapshots of a virtual hard drive to rapidly restart a VM. Snapshots allow an administrator to restore a VM to a previous configuration using an alternative virtual hard disk file.
Security and privacy
Virtual hard disks can be formatted using the same file systems as physical hard disks. As such, a file system that supports encryption -- such as NTFS -- can be used to encrypt the data residing on a virtual hard disk. Similarly, Windows VMs allow organizations to apply BitLocker encryption to virtual hard disks. Windows Server Hyper-V is also capable of encrypting entire virtual hard disk files through its Shielded VM feature.
Advantages of virtual hard drives
It's relatively easy to create or delete a virtual hard drive file, regardless of the type. Virtual hard disks are also portable -- with the exception of virtual hard disks that are associated with shielded VMs -- and can be moved from one system to another without too much trouble.
Disadvantages of virtual hard drives
Virtual hard drives can exhibit slower performance than physical hard drives due to the overhead associated with them. This is especially true for situations in which there are a large number of snapshots associated with a VM.
Virtual hard drives are also more susceptible to the unwanted removal of data from an organization because they are easy to copy and completely portable. The Hyper-V Shielded VM feature is designed to protect against this type of unauthorized use of virtual hard drives.