0

I am running VirtualBox 5.2_18 on Ubuntu 18.04 to host a Windows 7 instance as a guest system. The virtual hard disc is "dynamically allocated" and became too small for what I need to run within the Windows instance. I made four snapshots in the past if this is relevant. Therefore, I followed the large amount of articles on the topic on how to resize the virtual disk. Here is what I did:

  1. Unmount the disk in VirtualBox
  2. Resize the disk by executing VBoxManage modifyhd Windows7.vdi --resize 50000
  3. Remount the disk in VirtualBox
  4. Mount GParted ISO to resize the virtual disk

At this point VirtualBox understands the new virtual size (~50GB).
The actual size is still what it has been (13,42GB) as shown in this screenshot:

VirtualBox storage settings

Than I boot the GParted Live CD. As highlighted in the following GParted screenshot the disk size is still around 30GB which was the old size of the virtual disk.

GParted

How can I let GParted recognize the new disk size?

  • In my case, GParted (System Rescue CD boot) reflects the new VDI (block device) after running VBoxManage modifyhd --resize against the VDI. Looks like something went wrong during the modifyhd --resize, try to run again using a larger size and see if GParted detects the change correctly. – Terry Wang Jan 29 at 4:27
  • See the answer for more suggestions moving forward. – Terry Wang Jan 29 at 4:30
1

The process of resizing (growing) a dynamic VDI is to:

  • Run the VBoxManage modifyhd Windows7.vdi --resize 50000 to resize the VDI
  • grow the partition (can be the whole disk / block device) on which the file system is created so that it can leverage the additional spaces added (by resizing the VDI)
  • grow the file system (NTFS in this case)

Looks like the growing partition step didn't complete successfully.I've done at least 50 VDI resizes for VirtualBox VMs in the past (all Linux though, some were more complicated LVM layout, 1 VG, multiple LVs on single block device) using parted, all worked as expected.

NOTE: If you have multiple snapshots based on this VDI (means there is a VDI tree), I'd recommend doing a VDI clone to get a clean merged (coalesced) VDI of the current state, then do a VBoxManage modifyhd --resize on the new VDI, detach the existing VDI (with snapshots) from the VM and attach the resized clone, boot with System Rescue CD and check if the change is correctly reflected. If it does, all good, boot into Windows and run diskmgmt.msc to grow the volume to use the extra space.

  • Thank you for sharing your advice. I will be able to try them out by March 2019 when I have access to the computer again. I will let you know how it turned out. – JJD Jan 29 at 10:00
  • 1
    No problem, will be keen to know the result. BTW: if there is not more VMs running on the same box, try to upgrade VirtualBox version to the latest current release with minor, but don't jump to the next major release. This will avoid running into random Storage/VDI related bugs. – Terry Wang Jan 29 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.