VMware ESX vSphere resize disk
September 14th 2009 @ 12:38 pm Hardware, VMware

Every now and then I need to resize (usually extend/enlarge) a disk attached to a Virtual Machine. I have tried several methods to do this over the years (including combinations of VMware Converter, third party partition manager apps, diskpart etc) but none have been as efficient as the method I discovered during recent VMware training for my VCP4 exam.

One of the new features of vSphere is the ability to resize disks without having to shut down the Virtual Machine. This was previously impossible in VI3. This greatly speeds up the resizing process which can be executed in a couple of stages:

1) Use the vSphere Client to edit the settings of the Virtual Machine in question. Select the hard disk and modify it's provisioned size as appropriate. Click OK to apply these changes - resizing the .vmdk file.

resize1.png

2) Verify that the .vmdk has been resized by opening the Management Console -> Disk Management to find the unallocated space on the disk that resides in the .vmdk (distinguished by the black colour in the legend at the bottom.) In this case you can see I have increased the size by 5GB.

resize2.png

Right click on the disk (in this case 'Disk 0') and select properties. On the Volumes tab make a note of the unallocated space, in my case it is 5122MB.

resize3.png

Download Dell's EXTPART and extract it on the server that contains the disk you want to resize. Navigate to c:\dell\ExtPart (the default extracted location) and run extpart.exe. When prompted enter the the Windows drive letter of the disk on the Virtual Machine e.g. c:. When prompted for the size to extend the partition by enter the number noted down earlier (I used 5122 in this example.) After doing so the disk should be resized. You can check this by opening the Management Console -> Disk Management and verifying the size of the partition.

resize4.png

NB - If you receive the following error:

"Unable to connect to c: or it does not exist"

There are a couple of workarounds that you could try.

1) Close the Management Console (if it is open) and try extpart.exe again.

2) Try restarting the VM in safe mode and then run extpart.exe. This is not ideal but it is still easier than other methods I have tried to resize .vmdk files.

James Clements
rss 8 comments
  1. KS
    October 13th, 2009 | 6:18 pm | #1

    I was excited when reading this as I have been looking for an easy way to do this for a while.

    However, when attempting to use the ExtPart utility and trying to select the c: I get an error stating: Unable to connect to c: or it does not exist.

    Any thoughts?

    Thanks,

  2. James Clements
    October 13th, 2009 | 10:39 pm | #2

    Was the management console open when you tried it? Try closing it - I believe that when you view the 'Disk Management' snap-in it uses the 'Logical Disk Manager' service which extpart.exe also uses.

    If the above doesn't work try running extpart.exe in safe mode. Not ideal, but still far more efficient then attaching a 3rd party .iso or adding the virtual disk to another VM to resize the partition itself.

  3. KS
    October 14th, 2009 | 6:45 pm | #3

    Booting into Safe Mode solved the issue.

    Thanks for the help and this is still easier than the alternatives. Shouldn't there be a way to accomplish this through the VIC?

  4. James Clements
    October 14th, 2009 | 9:42 pm | #4

    I guess there *should be* but even the command line utility included with windows (diskpart) doesn't resize the OS volume on the fly. Similarly, most 3rd party partition applications that can be installed onto the operating system will not resize a volume containing the paging file. This is not the case if you boot the VM from a 3rd party app on an .iso or cd/dvd.

    If there is no Microsoft utility available to do this effortlessly (i.e. not requiring a separate .iso or cd/dvd and a reboot of the VM) then VMware probably won’t ever (need or want to) modify the UI on the vSphere client.

  5. Gelson
    October 28th, 2009 | 5:00 pm | #5

    It worked! No shutdown required.

    But beware: when you just run"extpart", the program asks the drive letter. It is essential that you type the letter followed by ":", otherwise the error "Unable to connect to C or it does not exist" occurs.

  6. Dom
    December 4th, 2009 | 11:34 am | #6

    Hi - on my VM's (v.7 ESX4.0), in the disk provisioning section on the dard disk properties it's all greyed out - can't change the size?
    why's that?

  7. Giankdir
    December 10th, 2009 | 4:30 pm | #7

    Hi Dom, this is probably because
    1- you cannot resize virtual disk if there are any snapshot of that VM;
    2- you cannot resize IDE disk (IDE disk are used to install windows XP to avoid the SCSI driver installation).
    Look at this post on VMware community
    http://communities.vmware.com/thread/238733

  8. addison
    January 7th, 2010 | 4:36 pm | #8

    Thank you. This worked well.

comment on this article