Disk image files reside on the host system and are seen by the guest systems as hard disks of a certain geometry. When a guest operating system reads from or writes to a hard disk, VirtualBox redirects the request to the image file.
Like a physical disk, a virtual disk has a size (capacity), which must be specified when the image file is created. As opposed to a physical disk however, VirtualBox allows you to expand an image file after creation, even if it has data already; see Section 8.23, “VBoxManage modifymedium” for details.[25]
VirtualBox supports four variants of disk image files:
-
Normally, VirtualBox uses its own container format for guest hard disks -- Virtual Disk Image (VDI) files. In particular, this format will be used when you create a new virtual machine with a new disk.
-
VirtualBox also fully supports the popular and open VMDK container format that is used by many other virtualization products, in particular, by VMware.[26]
-
VirtualBox also fully supports the VHD format used by Microsoft.
-
Image files of Parallels version 2 (HDD format) are also supported.[27] For lack of documentation of the format, newer formats (3 and 4) are not supported. You can however convert such image files to version 2 format using tools provided by Parallels.
Irrespective of the disk capacity and format, as briefly mentioned in Section 1.7, “Creating your first virtual machine”, there are two options of how to create a disk image: fixed-size or dynamically allocated.
-
If you create a fixed-size image, an image file will be created on your host system which has roughly the same size as the virtual disk's capacity. So, for a 10G disk, you will have a 10G file. Note that the creation of a fixed-size image can take a long time depending on the size of the image and the write performance of your hard disk.
-
For more flexible storage management, use a dynamically allocated image. This will initially be very small and not occupy any space for unused virtual disk sectors, but will grow every time a disk sector is written to for the first time, until the drive reaches the maximum capacity chosen when the drive was created. While this format takes less space initially, the fact that VirtualBox needs to expand the image file consumes additional computing resources, so until the disk file size has stabilized, write operations may be slower than with fixed size disks. However, after a time the rate of growth will slow and the average penalty for write operations will be negligible.
[25] Image resizing was added with VirtualBox 4.0.
[26] Initial support for VMDK was added with VirtualBox 1.4; since version 2.1, VirtualBox supports VMDK fully, meaning that you can create snapshots and use all the other advanced features described above for VDI images with VMDK also.
[27] Support was added with VirtualBox 3.1.