# IVirtualDiskImage Interface Reference

The IVirtualDiskImage interface represent a specific type of IHardDisk that uses VDI image files. More...

List of all members.

## Public Member Functions
void | createDynamicImage (in unsigned long long size,[retval] out IProgress progress)
| Starts creating a dymically expanding hard disk image in the background.
void | createFixedImage (in unsigned long long size,[retval] out IProgress progress)
| Starts creating a fixed-size hard disk image in the background.
void | deleteImage ()
| Deletes the existing hard disk image.
## Public Attributes
attribute wstring | filePath
| Full file name of the virtual disk image of this hard disk.
readonly attribute boolean | created
| Whether the virual disk image is created or not.

## Detailed Description

The IVirtualDiskImage interface represent a specific type of IHardDisk that uses VDI image files.

The Virtual Disk Image (VDI) format is VirtualBox's native format for hard disk containers.

Objects that support this interface also support the IHardDisk interface.

Hard disks using virtual disk images can be either opened using IVirtualBox::openHardDisk() or created from scratch using IVirtualBox::createHardDisk().

When a new hard disk object is created from scratch, an image file for it is not automatically created. To do it, you need to specify a valid file path, and call createFixedImage() or createDynamicImage(). When it is done, the hard disk object can be registered by calling IVirtualBox::registerHardDisk() and then attached to virtual machines.

The description of the Virtual Disk Image is stored in the image file. For this reason, changing the value of this property requires the hard disk to be accessible. The description of a registered hard disk can be changed only if a virtual machine using it is not running.

Interface ID:
  `{A8265B5A-0D20-4A46-A02F-65693A4E8239}`

## Member Function Documentation

void IVirtualDiskImage::createDynamicImage | ( | in unsigned long long | size,
|  | [retval] out IProgress | progress |
| ) |  |  |

Starts creating a dymically expanding hard disk image in the background.

The previous image associated with this object, if any, must be deleted using deleteImage, otherwise the operation will fail.

Parameters:

  | size | Maximum logical size of the hard disk in megabytes.
  | progress | Progress object to track the operation completion.

Note:
  After the returned progress object reports that the operation is complete, this hard disk object can be registered within this VirtualBox installation.

void IVirtualDiskImage::createFixedImage | ( | in unsigned long long | size,
|  | [retval] out IProgress | progress |
| ) |  |  |

Starts creating a fixed-size hard disk image in the background.

The previous image, if any, must be deleted using deleteImage, otherwise the operation will fail.

Parameters:

  | size | Logical size of the hard disk in megabytes.
  | progress | Progress object to track the operation completion.

Note:
  After the returned progress object reports that the operation is complete, this hard disk object can be registered within this VirtualBox installation.

void IVirtualDiskImage::deleteImage | ( |  | ) |

Deletes the existing hard disk image.

The hard disk must not be registered within this VirtualBox installation, otherwise the operation will fail.

Note:
  After this operation succeeds, it will be impossible to register the hard disk until the image file is created again.

  This operation is valid only for non-differencing hard disks, after they are unregistered using IVirtualBox::unregisterHardDisk().

## Member Data Documentation

attribute wstring IVirtualDiskImage::filePath

Full file name of the virtual disk image of this hard disk.

For newly created hard disk objects, this value is `null`.

When assigning a new path, it can be absolute (full path) or relative to the VirtualBox home directory. If only a file name without any path is given, the default VDI folder will be used as a path to the image file.

When reading this propery, a full path is always returned.

Note:
  This property cannot be changed when created returns `true`.

readonly attribute boolean IVirtualDiskImage::created

Whether the virual disk image is created or not.

For newly created hard disk objects or after a successful invocation of deleteImage(), this value is `false` until createFixedImage() or createDynamicImage() is called.