I have been using Sun’s (now Oracle’s) VirtualBox to run Ubuntu 10.04 as a guest operating system inside a Windows 7 host. I’ve also tried Windows 7 inside an Ubuntu host, but I’m doing it the other way ’round now since I end up using so many Windows-specific applications.
Anyway, what started out as an experiment has become a routine setup for me. Unfortunately, when I set up the Ubuntu guest, I didn’t give it much virtual disk space. So I’m confronted with cloning and enlarging the virtual disk I use for Ubuntu.
After reading many out-dated accounts of how to do this that don’t take into account the UUID and grub problems that could result in simply cloning the contents of disks, I think I have a solution. Here is what I tried using VirtualBox 3.2.2:
- Create a new virtual disk (vdi) the size you want using the tools in virtualbox (File -> Virtual Media Manager).
- Set the new vdi as slave in the specified Virtualbox (Machine -> Settings -> Storage).
- Download (if needed) and attach the latest .iso for Clonezilla (Settings -> Storage).
- Check that the boot order will pick up the CD before the hard drives.
- Use Virtualbox to boot from Clonezilla.
- Follow Clonezilla prompts to copy the old hard drive (vdi) to the new hard drive (vdi). Naturally, make sure you get order correct. Use the disk-to-disk option and allow Clonezilla to use grub when done.
- When done, use Virtualbox to dismount the Clonezille iso.
- If any adjustments are needed in the partitions on the new disk, you can download (if needed) the gparted live iso (the one you can boot from) and use virtualbox to boot from it. I had to do that to adjust the sizes of the partitions.
- After the new disk is just how you want it, dismount any iso from the cd drive, remove the original vdi drive, and reassign the new vdi drive the the top boot order (IDE primary master, e.g.).
- Now boot from virtualbox.
- If all goes well, give yourself a nice beverage.