Howto: Expand your C:\ drive in VMWARE ESX 3.5

Just as I did some days ago, you may face the problem that you’re running out of diskpace on your C:\ drive (system drive)  in VMWARE. Expanding the system drive is not as easy as expanding a non-system drive (like D:\, E:\ or whatever partitions you may have in your server :) )

These steps will guide you to expand your C:\ drive easily and without any risk. To ensure you don’t lose any data, we first have to make a backup of the vmdk. To do this, turn off the virtual machine a make a copy of the vmdk of the target server. You can do this with WinSCP for example, but if you don’t know how to use that, you can also make a clone of the server. A clone is a good backup too :)

Now that we have backup, we can start with the necessary steps to expand the disk. The following steps are taken from a forum topic of VMWARE. All credits go to GordonG.

1.3.0 Use the VI Client to connect to VirtualCenter

1.3.1 Remove the Disk from the Original Server

  • Select the VM, right-click and select Edit Settings
  • Select the hard disk and select Remove (DO NOT select the option to Remove and Delete).
  • Click OK to apply the changes.

1.3.2 Add the Disk to the Temporary Server

  • Select the VM, right-click and select Edit Settings
  • Click Add, then Hard Disk, Use An Existing Disk.
  • Browse to the datastore, directory and select the vmdk file that we are working with.
  • Click OK to apply the changes.

1.3.3 Expand the Partition

  • If the temporary server was shutdown boot it. If it was running, logon, go to Disk Management and do a rescan to detect the new disk.
  • Note that this will only work with Windows 2003 SP1 or later and only when the partition is the only one on the disk.
  • Login to the server as an administrator
  • Open a Command Prompt (*cmd*)
  • Type Diskpart
    Type list volume
    Type select volume n (where n is the volume/ partition you want to extend. Check the drive letters and use Disk Management to be sure).
    Type extend
    This will extend the selected volume to fill the entire disk. Check the changes in Disk Management

1.3.4 Remove the Disk from the Temporary Server

  • Shutdown the Temporary Server.
  • Select the VM, right-click and select Edit Settings
  • Select the hard disk and select Remove (DO NOT select the option to Remove and Delete).
  • Click OK to apply the changes.

1.3.5 Add the Disk Back to the Original Server

  • Select the VM, right-click and select Edit Settings
  • Click Add, then Hard Disk, Use An Existing Disk.
  • Browse to the datastore, directory and select the vmdk file that we are working with.
  • Click OK to apply the changes.
  • Power on the VM and check the disk in Disk Management.

You may also like...

11 Responses

  1. miniksharp says:

    I tried diskpart to extend C drive, but I received “Diskpart failed to extend the volume.” I eventually solved all problems with this tutorial: http://www.partition-magic.org/vmware/expand-vmware-disk-partition.html

  2. Praveen Kumar says:

    Very Nice topic. Thanks very much.

  3. Carlos says:

    I hope anyone doing the procedure gets to read this comment.

    DO NOT PROCEED WITH THIS PROCESS UNTIL YOU’VE REMOVED ALL SNAPSHOTS FROM THE VM!!! Otherwise, you kill the VM. This may be obvious to some but unless you’re like me and have little knowledge of VMWare it needs to be posted.

    • Douglas says:

      BTW if you (like me) did not read the warning about deleting the snapshots, do not panic!
      just:
      * boot from CD using your windows server installation ISO.
      * “R” to Repair installation
      * run CHKDSK /R

      this will fix your mistake.

  4. TZ says:

    Thanks much, this worked great!

  5. Sergio says:

    I just went through the process of expanding 4 of our servers. I am running ESX 3.5 VC 2.5 and I spent so much time researching the right steps and it turns out to be very easy if you are running Server 2008 VM’s.

    Steps for Server 2008:
    Power down VM
    In VC edit the HD to the new size
    Power on VM
    Under Storage Management, rescan drive and then right click on drive and choose extend volume.

    You are done!!!

    I did have to extend a WinXP and I did use extpart(dell tool) and it worked very well.
    instead of using the extend volume utility in 2008, download the extpart and then in a command window change directory to location
    Example:
    To extend the g: volume by 1 GB (1024 MB) use the following command:
    extpart g: 1024

    Hope this helps

  6. Andrew says:

    Never try the method that You are saying here. I’ve always use vmkfstools. After that depend what version of Windows:
    5.0 Diskpart
    or
    6.0 Disk Management

  7. Fredrik says:

    Have anyone tried Dell EXTPART to extend a system drive?
    I’ve used it on occation and not (yet) encountered any problems.

    http://support.dell.com/support/downloads/format.aspx?releaseid=R64398&c=us&l=en&cs=&s=gen

    Use vmkfstools or the VI client to extend the disk. Start up the VM and use EXTPART inside Windows to expand the disk. Fast (scary fast) and works on system partitions.

    Not just me using it either it seems..
    http://communities.vmware.com/thread/209553

    //Fredrik

  8. Benoit says:

    that’s a very good tips

    thanks for that

  9. Dan Edwards says:

    Dont you need t use the vmkfstools -x ##gb filename.vmdk first to expand the vmdk file inside of the ESX box?

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>