How to resize a virtual disk

Note: This is an old post in a blog with a lot of posts over a long span of time. The world has changed, technologies have changed, and I've changed. It's likely this is out of date, the code doesn't work, the ideas haven't aged well, or the ideas were terrible to begin with. Let me know if you think this is something that needs updating.

I use VirtualBox OSE for virtualizing test environments for Miro development. I built a Windows XP vm a year ago and when I did it, I put it on a virtual disk that was 8 GB which turned out to be waaaay too small for my needs. It's non-trivial to build a Windows build environment for Miro so I really wanted to clone the partition to a new virtual disk that was a lot bigger, then resize the partition rather than create a new virtual disk and reinstall and set everything back up.

I pretty much did that this morning in a couple of hours.

First thing I did was download the LiveCD of Clonezilla (version 1.2.1-23) and the LiveCD of GParted (version 0.4.1-2).

Second thing I did was create a 25 GB virtual disk in VirtualBox.

Then I attached the new virtual disk to the winxp vm that I had. Thus it should show up as hdb.

I booted into the Clonezilla LiveCD, cloned the old virtual disk to the new one keeping the partition sizes the same and making sure to copy over the MBR, too.

I switched around the virtual disks attached to my winxp vm and booted into the new virtual disk--worked great!

I booted into the GParted LiveCD, launched qtparted and grew the NTFS partition so that it used the whole virtual disk.

Then I booted into the new virtual disk. It did an NTFS disk check on startup which I thought might indicate the process didn't work right. Disk check passed, Windows XP booted and everything worked as well as I expected it to.

Want to comment? Send an email to willkg at bluesock dot org. Include the url for the blog entry in your comment so I have some context as to what you're talking about.