jump to navigation

Migrate a virtualbox VM to a bigger virtual disk 2012-03-18

Posted by claudio in Uncategorized.
Tags: , , , ,

When a virtual machine has limited use, you don’t want to loose too much space. Sometimes, however, you get the size wrong.

In my case, I have a minimal Windows VM on my Ubuntu laptop. Once in a while I test an upcoming Padre (The Perl IDE) release or update a crappy usb device with Windows-only support. Win-modems may be gone, but we still have GPS devices that run GNU/Linux but can only be connected to Windows. (I guess seeing your market-share shrink because of smart-phones is what they call bad karma, TomTom.)

Windows being Windows, adding disks is a terrible experience (what’s up with the alphabet as a mounting point?) and moving a Windows installation to a second disk is a nightmare. Luckily, free software gets the job done:

1. Make sure your guest machine is halted properly. This is specially important for a NTFS (virtual) partition of a Windows VM.

2. Download Ubuntu (It does not matter if you use the 32- or the 64-bit version, other GNU/Linux distribution will work as well). The screenshots are from a Ubuntu 11.10 setup.

3. In the specific VM-settings, add a new disk (to the same disk controller) and a new cdrom. Load the Ubuntu iso in the virtual cdrom drive.


4. Make sure the VM boots from the cdrom.


5. “Try” Ubuntu. Once Ubuntu is loaded, launch “gparted”.


6. Select the old disk (normally the first one, check the size).


7. Right on the disk representation and “copy” it.


8. Select the new disk from the combo-box on the upper right (check the size).

9. Go to “Device”, choose “Create Partition Table…”. Click “Apply” in the pop-up window.


10. Right on the disk representation and “paste” the original disk. Click “Apply” in the pop-up window.

11. Click on the green “Apply tick” on the icon menu to apply the changes. This will take some time. Get some coffee.


12. Right on the disk representation and select “Manage Flags”. Enable “boot”.

13. Shut down the Ubuntu Live cd.


14. Remove the original disk from the VM configuration (back it up first).


That’s it!



1. Christiaan Kras (@Htbaa) - 2012-03-18

There’s also a live cd with gparted on it, without having to boot into Ubuntu. This is a lot faster and works very well. http://gparted.sourceforge.net/livecd.php

2. Go Peter Jun (@gojun077) - 2012-03-20

Nowadays in Virtualbox 4.1.xx, you can use the CLI command ‘VBoxManage modifyhd’ to expand VM containers without copying the content from one and pasting it into a larger container. From the CLI if you enter:

VBoxManage modifyhd /path/to/VM/image XXX.vdi –resize 40000

It will resize your existing .vdi container to 40 GB. Beware, however, that the container expansion won’t work if you have any snapshots attached to the VM. Once you’ve expanded the .vdi, it will only show up in the Virtualbox manager; you’ve got to boot the VM into linux and use gparted (or a native WinXP partition mgr like EASEUS PM) to stretch the existing partition so it takes up all the extra space.

3. claudio - 2012-03-20

Good points (both of them). The methods are certainly faster. I wonder which of the three methods is the easiest for a casual user.

A plus point of the Ubuntu-cd method is that it exposes a potentially windows user to GNU/Linux…

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 )


Connecting to %s

%d bloggers like this: