Anyway, I did run out of disk space on my virtualbox guest. Came across a few web entries that discussed on how to overcome it, but most of them are applicable to Windows guest virtualbox setup.
Here are some of my attempts that didn't work out that well, and possible reasons:
1. Used Clonezilla
Use Clonezilla to back up the old VM and restore it into the new expanded disk.
Yup, I boot up my old version of Ubuntu using Clonezilla LiveCD and make a clone copy. Then boot up my new empty virtual image using Clonezilla LiveCD and tried to restore the image to the expanded disk image.
I was able to backup image of old Ubuntu VM, and managed to restore the image to the expanded VM volume, but when I boot up, it was not able to start up. This is due to GRUB loader. During the restoration of image, I briefly saw a message that there could be an issue since they detected GRUB and was not able to change to root to change some settings... I guess.
Failed (you might have better luck than me)
2. Use GPart
Create an empty (larger diskspace disk) virtual disk using VirtualBox Virtual Media Manager. Attached the larger virtual disk to the SATA port 1 (the old smaller virtual disk on SATA port 0). Mount GPart LiveCD and boot from it. Copy the old disk (/sda1) to the new disk (/sdb). Mark the new disk as bootable. Reboot with the new disk as primary (might also want to unmount the old disk).
No problem with the copy and paste using GPart. No problem with the flag "boot" for the new disk. Just didn't boot after when switch to primary boot disk!
Unknown. Still figuring it out.
Here is what worked for me.
I have the following:
1. Oracle VirtualBox 3.2.12 r68302
2. Ubuntu 9.10.2 (8 GB HD)
What I want to do is to add more hard disk space (increase to 16 GB HD).
1. Create a virtual disk of larger size
- Through Oracle VirtualBox GUI, select File > Virtual Media Manager > Actions > New
- Fill up the 'Create New Virtual Disk' form
C:\Documents and Settings\user\.VirtualBox\HardDisks>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonehd "MyFirstSmallerDisk.vdi" "MyLargerSecondDisk.vdi" --existing
Oracle VM VirtualBox Command Line Management Interface Version 3.2.12
(C) 2005-2010 Oracle Corporation
All rights reserved.
Clone hard disk created in format 'VDI'. UUID: 2fe48578-ade7-48fa-873b-2245714074f5
(some of the information are scrumbled and replaced, especially those in blue. Replace the name of the vdi files appropriately)
This will clone the smaller virtual disk to the larger one.
3. Create a new VM through the Oracle VirtualBox GUI, select Machine > New
- Enter a new name for this VM (e.g. "MyLargerSecondVM")
- Choose Linux, Ubuntu for OS Type
- Enter the memory size
- Check "Boot Hard Disk" and select "Use existing hard disk" > "MyLargerSecondDisk.vdi"
5. Shutdown the VM after everything looks fine. Back up the VMs.
- I copied all the files under "C:\Documents and Settings\user\.VirtualBox" to another secondary storage.
It is now time to resize the partition to fill up the entire new virtual disk.
6. Ensure that the boot order for the new VM ("MyLargerSecondVM") is (CD/DVD-ROM, Floppy, Hard disk) via Setting > System > Motherboard
7. Ensure that the GPart LiveCD is mounted. Setting > Storage > IDE Controller > CD/DVD Device > [select the gpart iso file, e.g. gparted-live-0.8.0-5.iso]
8. Reboot the VM ("MyLargerSecondVM")
9. Enlarge the primary boot partition. You might need to move the swap partition to the end of the disk before enlarging the primary boot partition. I did the changes in a series of small steps rather than applying all changes at one go. I actually hit to a slight problem initially if I will to consolidate all my steps.
10. Once the swap partition is moved to the end, and primary partition has been enlarged successfully, quit GPart and reboot. Remember to unmount the GPart LiveCD through Setting > Storage > IDE Controller > CD/DVD Device > [Select "Empty"]
11. Reboot "MyLargerSecondVM" and login. You can check that you have more disk space now. e.g.
% cd /
% df -k .