VBOX: Extending VHD

Mohamad MahmoodMohamad Mahmood
1 min read

VirtualBox provides a built-in command-line tool called VBoxManage , which allows you to resize VHD (or VDI/VMDK) virtual disk images.

Resizing a VHD using VBoxManage

Syntax:

VBoxManage modifymedium "path/to/your.vhd" --resize [SizeInMB]

Example:

If you want to resize a .vhd file to 50 GB :

VBoxManage modifymedium "C:\VMs\MyVM\disk1.vhd" --resize 51200

After resizing, you must log into the guest OS and use tools like:

  • Windows Disk Management (diskmgmt.msc)

  • or GParted (for Linux)

Limitations:

  • You can only resize dynamically allocated disks in some versions of VirtualBox.

  • Fixed-size disks may not be resizable via modifymedium. In that case, you may need to:

    1. Clone the disk to a new larger dynamic disk.

    2. Replace the old disk with the new one.

Example:

VBoxManage clonehd "old.vhd" "new.vdi" --format vdi
VBoxManage modifymedium "new.vdi" --resize 61440

After you have extended the VHD, you need to configure in the OS.

**

For Windows XP:**

  1. Start the VM.

  2. Inside the VM:

    • Click Start \> Run , type diskmgmt.msc and press Enter.

    • In Disk Management, locate the disk — it should show unallocated space at the end.

    • Windows XP does not allow extending logical disk. You need to allocate the new space as new disk and assign a drive letter.

0
Subscribe to my newsletter

Read articles from Mohamad Mahmood directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mohamad Mahmood
Mohamad Mahmood

Mohamad's interest is in Programming (Mobile, Web, Database and Machine Learning). He studies at the Center For Artificial Intelligence Technology (CAIT), Universiti Kebangsaan Malaysia (UKM).