Increase the size of vmdk or vdi (Virtualbox)

A major part of my PC experience is linked to Ubuntu. I’d always have Ubuntu installed on the machines I work on. No marks for guess that I am still using Linux and posting from inside it. Well in a way I am also a Linux evangelist; Sometimes even the office machines would secretly taste the flavor of Linux, thanks to the Boot from USB. Almost all my friends have Ubuntu installed (yeah coz of me) and I’d SSH to their machines and play songs etc remotely and things get all funny and haunting initially. I just love it.

Anyway there was this Virtual Disk File (VMDK of VMWare fame) that I created under VMWare and now it can even be used from VirtualBox (good stuff). So I booted inside it and it was running low on disk. I couldn’t install MS Office on it. So I figured it was time to RESIZE the disk.

#1 (clone the disk to a vdi format)

$ /usr/lib/virtualbox/VBoxManage clonehd “windows-xp-64bit.vmdk” “windowsXP.vdi” –format vdi

— windows-xp-64bit.vmdk = source vmdk

— windowsXP.vdi = target vdi

#2 (use the vdi disk and resize it to the desired capacity)

$ /usr/lib/virtualbox/VBoxManage modifyhd “windowsXP.vdi” –resize 10000

— here we are re-sizing it to 10Gb.

Now that we have a new vdi. Simply change the settings in the VirtualBox and use the new VDI.

Use the new VDI

Use the new VDI

Now, after we booted in the brand new OS, we have two options.

A) Use GParted to resize the partition (expand it).

download GParted ISO; And boot with that ISO instead of the VDI and resize the C Drive. Next reboot in the VDI and we are done!

B) Use Windows Disk Management Wizard and create a new partition with the recently inherited storage.

Create a new partition

Create a new partition

That’s all.

Take a bow!

 

 

Update:

How to merge snapshots together:

VBoxManage clonehd fullpath/{uuid-of-last-snapshot}.vdi thedisk-full.vdi

clonehd only the last snapshot.

The uuid can be found from VBoxManage list hdds | grep VmName | tail

In the GUI (on Windows), select the VM, select Snapshots from the top right, right click on the snapshot you want, select Clone…, and select Full Clone in the dialog.

Advertisements

10 thoughts on “Increase the size of vmdk or vdi (Virtualbox)

  1. I get an error message when trying to resize above 10GB for a .vdi clone using #2:

    Error: Resize hard disk operation for this format is not implemented yet!

    Do you know of any workaround?

    • Hello there! Are you just running the Step2 — because that might cause it.
      Do you have a Fixed Storage Disk or a Dynamically Allocated one?
      Fire away the first step anyway and that would create a brand new Dynamic Storage Disk.
      🙂 Hope that helps. Do let me know!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s