« Backing Up and RestoringHOWTO To Change The Hostname »

HOWTO Enlarge A VMware Disk

26/07/08

HOWTO Enlarge A VMware Disk

This is what I do to make sure I can easily and simply enlarge the virtual disk for my Linux Vmware guests.

When installing make sure there is a /boot partition of around 250Mb at the beginning of the disk. This is plenty and should never need to be resized.

Next I put the swap partition and then the remaining unused disk as a single partition mounted as root. This means the disk space that is in use is at the end of the disk. If you put the swap space at the end of the disk you have to keep moving it and that just takes time.

I also add a label to both the boot and root partitions created above as it makes identifying in the /etc/fstab much much easier.

...

For a Ubuntu Server (Hardy) I use a 2Gb disk, pre-allocated space. As described above it is divided up as 250Mb boot, ext3 followed by 512Mb Swap the remaining is with reiserfs.

Check Disk Useage before

df -h / 


Filesystem            Size   Used Avail Use% Mounted on 
/dev/sda3             1.3G   377M  942M  29%  / 
/dev/sda1             236M    24M  201M  11%  /boot

When you need to enlarge the disk, close down the Vmware guest machine and from the host machine we can make the disk larger with the Vmware tool. Say we want to add another 1.5Gb that makes the total disk size 3.5G.

vmware-vdiskmanager -x 3.5Gb disk_enlargement.vmdk
Using log file /tmp/vmware-richard/vdiskmanager.log 
  Grow: 100% done. 
The old geometry C/H/S of the disk is: 261/255/63 
The new geometry C/H/S of the disk is: 456/255/63 
Disk expansion completed successfully. 
 
WARNING: If the virtual disk is partitioned, you must use a third-party 
         utility in the virtual machine to expand the size of the 
         partitions. For more information, see: 
         http://www.vmware.com/support/kb/enduser/std_adp.php?p_faqid=1647

 


We need to use gparted to enlarge the partition on the drive without loosing all the data. So Load up another Vmware guest and add the disk we just enlarged. Gparted needs X, I use my default Desktop install here. Boot this other machine and make the partition larger with gparted. When that is complete. Close down the Vmware machine and boot the guest you are altering the disk for.

Check all went well with the disk free command. If the guest boots it's a pretty good sign. :D

Check Disk Usage after

df -h / 


Filesystem            Size   Used Avail Use% Mounted on 
/dev/sda3             2.8G   377M  2.5G  14%  / 
/dev/sda1             236M    24M  201M  11%  /boot
If you put the swap area at the end of the drive you have to move that as well. That just adds complication so I don't do it.

No feedback yet

Here are a collection of Mini-HOWTOs some of which are too short even for that grand title. I keep them around as it is easier to remember where to look these up that to remember the content of the mini-HOWTO

Search

Contents

blog software