Saturday, July 10, 2010

How to Increase the Size of VirtualBox Virtual Machine Disk Image


I have installed Ubuntu on my Mac OS X desktop through virtualization using VirtualBox, and it has been running really well. My only problem is that I created a virtual machine disk image that is too small (only 5GB), which I wanted to increase in size since I now realized that the space is not enough. At the moment, VirtualBox doesn't have a built-in disk-resizing tool so I resorted to cloning the existing VM disk of Ubuntu into a new larger VM disk image, and then resize the clone to occupy the space of the larger VM disk. Sounds complicated? Not really.

Allow me to share with you the easy steps in increasing the size of a VirtualBox virtual machine disk image with Ubuntu as guest OS.

What you'll need:

1. CLonezilla (Download the ISO file HERE)

2. Ubuntu LiveCD or any LiveCD that has GParted

Before you begin, take note that this how-to is intended for those who have already learned the basics of using VirtualBox.

What to do:

1. Using the VirtualBox Disk Manager, create a bigger dynamically expanding virtual disk image. I created 7GB on mine.

2. Add the new larger virtual disk image as the primary slave of your existing Ubuntu virtual disk.

3. Set up your Ubuntu virtual machine to mount the Clonezilla ISO disk image that you have downloaded.

4. While booting from Clonezilla, select disk-to-disk cloning mode, and when the cloning is finished, shutdown the virtual machine.

5. From the VirtualBox Disk Manager, set the larger or your newly created virtual disk that now contains the clone as the primary master disk.

5. Now set up the VM to boot from the Ubuntu LiveCD ISO or to other available LiveCD with GParted. Boot from it and open or run GParted.

6. Using GParted, you will see your VM disk images and if you created a swap partition it must be moved all the way to the right together with the extended partition it is on before you can resize the root partition.

7. Click the swap partition, and then click the "swapoff" option. GParted will close, but just open it again.

8. Enlarge the extended partition, and then the swap. After enlarging your partitions, save the changes and shut down Ubuntu or your virtual machine.

9. From the Virtual Disk Manager, set up your VM to mount from the primary master disk image, and then just remove your old primary master disk.

10. You will now have a bigger VM disk image on your guest OS without destroying any of your data.

You may want to read about my older entries that are also related to virtualization software:

How to Install Windows 7 on Ubuntu Using VirtualBox

Virtual Machine vs. Boot Camp

Installing Parallels Desktop 4 Tools on PCLinuxOS 2009 Guest

Installing Parallels Tools with Ubuntu as Guest

Posted via email from ://allthings-bare

No comments:

Post a Comment