Investigating a resize failure of a guest Windows virtual disk in a VirtualBox environment.
Before proceeding with any modifications to a virtual disk, ensure you have healthy backups in place.
The following error was encountered during a resize, following a (recommended) clean shutdown of the Windows guest:
1 2 3 4
Per the VirtualBox documentation, the –resize option is only supported for dynamically allocated disk images, and limited to VDI and VHD.
To confirm the format variant of our Windows guest virtual disk, start by listing all available virtual disks:
1 2 3 4
With the absolute location of the virtual disk, we can return specific information for the image:
At this point, we have confirmed that the virtual disk in question is using a fixed format, which (per the above VirtualBox documentation) is incompatible with the –resize option.
Let’s clone the virtual disk:
1 2 3
Note, the cloning operation may take some time depending on the size of the source virtual disk and the configuration of the underlying storage layer where the image physically resides.
No additional options need to be supplied to the clone command (above) as the default format variant is dynamic.
To confirm the format variant of the new VDI:
Resize the Partition
Now that the format variant of the new VDI is dynamic, we can proceed with a successful resize:
You can now attach the new (larger) virtual disk to your VM and proceed with a filesystem resize (from within the guest as the space has merely been allocated) using whatever tool(s) you prefer, for instance, Microsoft’s built-in Disk Management, GParted, etc.
Happy new year!