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.21, “VBoxManage modifyhd” for details.[21]
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.[22]
VirtualBox also fully supports the VHD format used by Microsoft.
Image files of Parallels version 2 (HDD format) are also supported.[23] 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 expanding.
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 expanding image. This will initially be very small and not occupy any space for unused virtual disk sectors, but the image file will grow every time a disk sector is written to for the first time. While this format takes less space initially, the fact that VirtualBox needs to constantly expand the image file consumes additional computing resources, so until the disk has fully expanded, write operations are slower than with fixed size disks. However, after a dynamic disk has fully expanded, the performance penalty for read and write operations is negligible.
[21] Image resizing was added with VirtualBox 4.0.
[22] 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.
[23] Support was added with VirtualBox 3.1.