Ubuntu 704 on VMWare - Increase root partition size
The root partition of my Ubuntu 704 Server Virtual Machine was only 5GB and was filling up regularly. Incresing the size is quite complex as you have to increase the size of the VMWare disk file, then increase the size of the file system partition within the disk file. Here are the steps I went through and a few hints and tips along the way.
1. On the host system, increase size of VMWare disk files
(I added the VMWare folder to my PATH first)
D:\VMWare\ubuntu704server>vmware-vdiskmanager -x 10GB Ubuntu.vmdk
I also changed the file type to dynamically extend (that's the -t 0), which renames the file in the process. This is an optional step as it can affect the performance of the VM.
D:\VMWare\ubuntu704server>vmware-vdiskmanager -r Ubuntu.vmdk -t 0 Ubuntu-000001.vmdk
2. Download the latest gparted livecd and save to host's file system
gparted is a GUI tool for manipulating partitions. I tried a number of different tools before the gparted livecd, including qtparted on the latest Knoppix livecd. With the Knoppix qtparted, the resize option was continually greyed out. I did some digging and it seems the underlying parted didn't like whatever Ubuntu do to the ext3 file system, so any tools on top (such as qtparted) can't resize. The gparted livecd worked perfectly so I didn't investigate further.
3. In the VM settings, change the VM's CDROM to point to the newly downloaded gparted livecd iso image
4. Boot the VM, but press Esc asap and tell the VMWare bios to boot from CD first
5. Reboot the VM into the gparted livecd
6. When it eventually loads, point gparted at the disk device (/dev/sda). Delete the swap partition (/dev/sda5) and then delete the logical partition (/dev/sda2). /dev/sda5 was "inside" /dev/sda2.
The /dev/sda5 swap partition was at the end of the original 5GB drive, but was now sitting in the middle of my 10GB. I couldn't figure out how to move the swap back so it was just easier to drop it and recreate it after I resized the main /dev/sda1 partition.
7. Resize the 1st partition to almost fill the available space, saving 512MB for a new swap partition
8. Create a new logical partition in the available space, gparted should automatically name this /dev/sda2 when you commit changes.
9. Create a new linux-swap partition inside the /dev/sda2 partition, gparted should automatially name this /dev/sda5 when you commit changes.
10. Reboot the VM, enter the VMWare BIOS and change boot priority so that the VM will boot from it's disk.
That's it !