You are hereResizing an Unresizable VMWARE Virtual Machine

Resizing an Unresizable VMWARE Virtual Machine


By steve - Posted on 09 February 2007

I've been working with the SugarCRM Virtual Machine Appliance (sugarcrm-os-4.5.0f-x836) for software development and testing. I make changes to the Virtual Machine using a combination of subversion, eclipse, and vmware server. I currently use the free version of vmware, vmware server 1.0.1. Subversion and eclipse are both open source.

I ran into a problem, though, because the virtual machine virtual disk, as created by the SugarCRM developers was not allocated large enough for my use and would run out of disk space with very little usage.

I tried to use the free VMWare Converter 3.0 to convert it and increase the size of the disk, but I kept getting an error that it "cannot configure the source image".

So, my workaround for resizing an uncooperative vmware disk image is to use the vmware-vdiskmanager program that is included in the vmserver installation to increase the disk, then use a gparted live CD to increase the volume size to fit the new virtual disk size.

Here's how...

Part 1: Expanding the VM disk with vmware-vdiskmanager

  • Backup your vm. Seriously... Back it up now.
  • Remove snapshots from your vm image, if there are any (use vmware server, right click on the vm, select remove shapshot). This will prevent an error that happens if you try and expand a vm with snapshots.
  • Exit out of vmserver and anything else that might be using the virtual disk or machine or you'll get an error
  • In windows, open a command window by clicking start/run then entering cmd and pressing enter
  • Change to the directory that has your virtual disk, for example:
    C:\> cd "\virtual machines\sugarcrm"
  • Run the command to expand the allocated virtual disk:
    c:\virtual machines\sugarcrm>"\program files\vmware\vmware server\vmware-vdiskmanager" -x 10gb sugarcrm-os-4.5.0f-x86.vmdk

    In this example, I'm expanding the disk to 10 gigabytes. Substitute your own size and vmdk file name.

    I had problems expanding this particular VM and getting it to boot properly (it would hang on the GRUB stage1 screen). I didn't have time to figure out the combination of settings to get this to work (after trying too many variations to list), so I just bumped up the size of the virtual disk and used fdisk to create a new large partition and moved /var /usr and /svn to the new partition. This allowed grub to boot as normal and I had the extra space I needed.
  • You should get a result like this (the Grow: value will increase until you get to 100%):

    Using log file vdiskmanager.log
    Grow: 100% done.
    The old geometry C/H/S of the disk is: 610/128/32
    Preserving old geometry.
    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

  • You can test your update by starting the vm using vmserver. If you get to the command line and do a: df / or equivelent command, you'll see that nothing has really changed! This is because you've only changed the disk allocation, not the volume. If you have experience, you can probably go ahead and handle things from here to expand your volume. However, if you don't have a lot of experience, you can use a gparted Live CD to resize your partition (see part 2 below)

Part 2: Expanding the Partition with gparted

If you are just going to use fdisk to create the new partition and move things around, don't do this part--only do this part if you want to attempt to create a single expanded partition. Of course, you might corrupt things when you run gparted, so you'll want to backup your newly expanded virtual disk before continuing...

  • Make a backup of the virtual image before you try to resize it.
  • Download the gparted live CD iso from here:
    http://gparted.sourceforge.net/
  • Put the ISO in a place you can find
  • Start VMserver
  • Select the vm, but don't start it
  • Edit settings and select the CDROM
  • Select "Use ISO image" and browse to the gparted ISO file and click Open. Make sure "Connect at power on" is checked. Click OK.
  • Now you have to be kind of quick here... We want to boot to the CD, not the VM's disk, so start the vm, click on the boot window while vmware is just coming up, then press the ESC key pretty quickly. This will bring up the boot menu. Select "CD-ROM Drive" (option 3 for me). If you can't get it to boot from the CD doing this, you may have to go into the setup, boot options, and make CDROM the only option.
  • As you boot from the ISO image (virtual CD?), you'll see a splash screen for gparted. Answer the prompts for extras, language, keyboard, etc. until you get to the first window.
  • Note: I had to take some special options to get this to work, but the key was probably using the old xserve video option.
  • Follow gparted's processes to expand your volume.
  • In my case, I had a 1.19GB /dev/sda1 volume. I clicked on it, then selected resize/move. I increased the "New Size" to the maximum size, then clicked the Resize/Move button, then clicked "Apply" on the toolbar and confirm that you want to do this. It will run for awhile (my system took about 10 minutes to go from 1.2gb to 10gb).
  • Exit gparted. Before you reboot, undo the changes you made to get it to boot from the gparted ISO (disconnect the ISO image from the CDROM and change your boot options, if necessary).
Tags

I have followed these instructions to the letter but with little success. Does this work with a Windows 2003 server VM ?

excellent help
thanks for posting this article
it worked prefectly reszing an Ubuntu VM on a Windows XP host

Did this help you? You can help me!


Did you find this information helpful? You can help me back by linking to this page, purchasing from my sponsors, or posting a comment!


+One me on Google:


Follow me on twitter: http://twitter.com/mojocode







Comments



Affiliation Badges