Recently, in one of my VMWare system (with Windows XP host OS and Ubuntu guest OS), I ran into disk space shortage while installing a package (Thrift – A cross language service). Though there were many articles on the Internet in helping extending the guest OS partitions, they were for older versions or not applicable any more or had many complex steps. On spending some time and digging more on the issue, I found pretty straight forward steps in achieving what I wanted to do – doubling the disk space for Ubuntu.
Host OS: Windows OS
Guest OS: Ubuntu Karmic (had 8G pre-allocated)
Disk: 148G Total and 60G Free out of which 8G to be allocated to Ubuntu
Double Ubuntu disk space to 16G by adding a new partition
Run “disk analyzer” and get current disk space usage data that provides total, used, available and usred. See below. The system has less than 10% free disk space and needs more.
On deciding to go with allocating new disk space, you must first back up the disk and turn-off the virtual machine. Select the virtual machine, if you have more than one in VMPlayer, and click “Edit virtual machine settings” and click Hard Disk item and set the expand disk capacity to 16G. (8 + 8) as show below. Also make sure that you have enough free space available (in host) to allocated to guest OS.
Download “gparted” – a GUI disk utility by running
> sudo apt-get install gparted
> sudo gparted
Select the “unallocated” partition and select “Create partition”. In the pending operations pane you will see “Create Primary Patition …” and click “Apply All Operations” (A green check mark in tool bar).
Now mount this new partition. Say for example, I am going use this for /src2 directory, then
> sudo mkdir /src2
> sudo mount -t ext4 /dev/sda3 /src2
Move some big directories to this partition or new directory and thus releasing some disk space free on /dev/sda1 in my screen shots above. And after the move I had 60% free on /dev/sda1 partition (an important boot partition)
> mv /big_directory /src2/big_directory