Monday, July 16, 2007

VMware: Run out of a disk space

Today, suddently i couldnt log on to our development machine/box via Xwindows/GUI. The system could not write to the disk because there isnt any space. So i connect through SSH (u could use Ctrl+Alt+f1, to log in locally via console) and i simply remove all the installed packet cache at "APT cache directory (/var/cache/apt)". So i have some space to log in again, but its not the real problem :), the problem is our Ubuntu box running under the VMware (we are using virtual machine to install multiple OS) with 4.0GB disk space (virtual disk) when we create it, now we`re facing a big problem because we actually need more n more space to put so many tools/software.

So i decide to move "/home" directory (also /var, /tmp, etc) to another partition, and this is how to do that :

1. creating new "vmware virtual disks" and adding it as a new partition to the ubuntu,
Select your virtual machine Ubuntu and then "right-click", choose "Settings" -> Add -> Hard Disk -> choose IDE/SCSI -> decide the capacity -> [your new virtual disk]

2. boot up your ubuntu
3. After login to your account, do ( do all the step below as root) :
- format your new partition(/dev/hdb1); use qtparted to make this works easier
- mount the partition to new directory
#mkdir /media/tmp
#mount /dev/hdb1 /media/tmp

- Copy all of your subdirectory under "/home" directory (user home directories) to "/media/tmp
cp -R -a /home/* /media/tmp/
- Delete your old subdirectories under your /home directory
#rm -rf /home/*
- Unmount your "/home" directory and unmount /media/tmp
#umount /home
#umount /media/tmp

- Mount your /dev/hdb1 to /home
#mount /dev/hdb1 /home
- modify your "/etc/fstab" file, and adding
/dev/hdb1 /home ext3 rw 0 0
- Remove /media/tmp
#rm -rf /media/tmp

4.Then reboot your machine, if everthings went ok. You wil have new /home directory under "new partition" with more free space.

This also could be done to another directory, such as /var, /tmp or else

Cautions: : Backup All of Your Data first


1 comment:

  1. I've installed VMWare to use a 2nd HD 80GB in size to use 70GB for the installation of SBS 2003 Standard. Within the OS disk manager, shows only 19GB of 80GB being used and over 50GB of unallocated space. However, VMWare is consuming the entire volume showing that only 74MB is available. As I test a recovery process, I know that I am going to run into problems reloading the VM SBS2003 after the recovery process. Does anyone know how I can make the available 50GB+ usable in VM for me to continue my testing? Any assistance is greatly appreciated. Thanks and Merry Christmas.