Tuesday, September 30, 2008

How to increase the disk space on a xubuntu VM

Always check out the original article at http://www.oraclequirks.com for latest comments, fixes and updates.

Although this problem is not strictly oracle related, it may be useful for anyone who needs to increase the available disk space on a xubuntu (and ubuntu as well i guess) vmware virtual machine where an Oracle instance is running.

The following procedure has been carried out on VMWare Fusion 2.0 (for Apple Macs platforms).

Original problem: i had a rather small xubuntu VM with 1GB RAM and 8GB (7GB+1GB swap disk) and i wanted to increase the space of both sda1(the main partition) and sda5 (swap partition) up to a total of 32GB (28GB for sda1 and 4GB for sda5).

Before starting i recommend that you make a copy of your VM files, just in case and of course the usual disclaimers apply.
  1. Increase the virtual disk space setting to the desired amount in the configuration panel of the VM. This operation is currently allowed only if there are no VM snapshots, so, you'll have to delete them first;
  2. Download gparted;
  3. Use the gparted ISO image as a virtual CD in VMWare or burn a physical CD using the file image;
  4. Reboot xubuntu with the CD inserted and connected;
  5. If your VM doesn't boot from CD, then you need to change the device boot sequence in the BIOS. Restart the VM and keep pressing F2 until the BIOS screen shows up.
  6. Resize and/or move the existing partitions until you get the desired size for all the partitions and apply the changes;
  7. Eject the CD and restart the VM normally;
  8. By changing the partition properties of the swap area, most likely the existing UUID of the partition has changed as well: verify with the command sudo blkid the current UUID of the swap partion and compare it with the UUID stored in /etc/fstab;
  9. If the two UUIDs are different, perform the following three additional steps:
    1. sudo swapoff -U old_UUID where old_UUID is the value contained in /etc/fstab;
    2. update /etc/fstab by executing: sudo vi /etc/fstab in order to update the file (copy and paste the new UUID from the output of blkid);
    3. perform: sudo swapon -a;
  10. If no errors are returned, you should be able to see the updated amount of available memory with the command: free -m;
The procedure worked out well in my case and i completed all the tasks in less than 30 minutes.
Actually it took me a while to figure out initially what was wrong with the command swapon -a, because i was getting the somewhat funny message "cannot canonicalize /dev/disk/by-uuid/...", at that point i realized that i had to update the UUID in /etc/fstab.

Shorter solutions are welcome :-)

1 comment:

Davis said...

Hi, I posted a blog on how to install Oracle on Xubuntu/VMWare that includes info on various tricks to compress the image. Nice tip on how to grow the disk.

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles