Home > Hardware, VMware > VMware ESX vSphere resize disk

VMware ESX vSphere resize disk

September 14th, 2009 Leave a comment Go to comments

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

If you are using Windows Server 2003 or earlier versions of Windows (Note: Windows Server 2008 now allows you to resize a disk through Disk Management in the Computer Management Console/Server Manager even if this disk is the Boot/Page File disk) 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.

Categories: Hardware, VMware Tags: , ,
  1. KS
    October 13th, 2009 at 18:18 | #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 at 22:39 | #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 at 18:45 | #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 at 21:42 | #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 at 17:00 | #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 at 11:34 | #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 at 16:30 | #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 at 16:36 | #8

    Thank you. This worked well.

  9. KK
    April 20th, 2010 at 15:00 | #9

    What about to shrink the size of the virtual disk? When i iedit the settings to make it smaller it goes back to the original size. We are importing physical machines to the virtual environment and some disk are way too big....

  10. James Clements
    April 21st, 2010 at 16:04 | #10

    Hi KK, the easiest way to shrink a VMDK is probably to use VMware converter. This can be done in a few simple steps:

    1) Install VMware Converter on the VM that you want to shrink the VMDK(s) of.
    2) Run VMware Converter and select the options to 'import a machine' and then 'this local machine'.
    3) Select the volumes you want to import and change 'maintain size' to 'type size' and specify your reduced VMDK size(s).
    4) Complete the wizard to import the virtual machine
    5) Shutdown the original VM and power on the newly imported VM (with the smaller VMDK(s)

  11. Nacho Libre
    May 25th, 2010 at 00:46 | #11

    Just tried this, worked perfect. Thanks!

  12. Jon
    June 9th, 2010 at 22:50 | #12

    I tried this, was not sure it worked as other websites had much more complex ways to do this but this worked amazingly and was so simple!

  13. santiago
    June 11th, 2010 at 23:14 | #13

    I just made an extension on volume c:. It runs fine. Thank you

  14. Pär
    August 17th, 2010 at 12:41 | #14

    Excellent guide, worked perfectly!

  15. Antono
    September 23rd, 2010 at 16:16 | #15

    It worked perfect, no shutdown or reboot required and very simple procedure. Excellent! Thank you so much for sharing this! God bless.

  16. cfizz34
    October 19th, 2010 at 17:31 | #16

    I really wished this worked on x64 machines.

  17. WarrenG
    November 17th, 2010 at 11:02 | #17

    This worked a treat, just remember to close the disk manager prior to running the utility.

  18. Brett Douglass
    November 25th, 2010 at 21:31 | #18

    No its safe mode that's the resolve.
    You Must be in safe mode to use the Extpart i think
    Thanks Dell 🙂

  19. Marcel
    December 7th, 2010 at 07:01 | #19

    Does anyone have an idea to make this work on a 64-bit OS?

  20. James Clements
    December 7th, 2010 at 07:48 | #20

    Hi Marcel, I haven't tested this to confirm it but I have read that extpart.exe does work on 64bit machines. It is actually the self extractor that doesn't extract on a 64bit OS. Extract it on a 32bit machine, and try running extpart.exe on your 64bit OS. I would actually be interested to see the result 🙂

  21. Marcel
    January 18th, 2011 at 20:18 | #21

    @James Clements
    worked indeed perfectly, thanks! Also found out that you dont need the tool with W2k8. But instead you can use the intergrated disk manager.

  22. James Clements
    January 21st, 2011 at 10:02 | #22

    Hi Marcel, I should have probably mentioned that as of Windows Server 2008 you can now extend a disk using the Disk Management utility from the computer management console, even if this disk is the Boot/Page File disk. 🙂

  23. Jarrod
    March 31st, 2011 at 05:46 | #23

    Thanks for this. I've got my host datastore setup with 406GB and two VM's with 200GB and 150GB however the datastore is only reporting 1GB of free space. If I go and change the VM disk sizes, the change is accepted however when I go back to check the change the old value is there.

    Any ideas?

  24. d_frost
    March 31st, 2011 at 20:29 | #24

    in my vSphere client, when i go into Edit Settings for the vm i want to increase the size of, i am not able to change the size of the disk, all options are grayed out, this is the case when the vm is powered on or powered off. any ideas?

  25. James Clements
    April 1st, 2011 at 08:03 | #25

    @Jarrod
    The only time I have ever seen anything like this was when the datastore that was being presented to the server was larger than the configuration maximum for the version of vSphere that you have installed. So - the vSphere maximum datastore size was 2TB and I presented a 4TB to the host and the host then started to report an incorrect datastore size. I can't think of anything else that may cause this.

    @d_frost
    There are usually 2 reasons for this happening. The first is that the virtual disk currently has an open snapshot. You will need to commit the changes by deleting the snapshot if you are finished with it. The second reason is that the virtual disk is connected to a virtual IDE controller and not a virtual SCSI controller. Any virtual disks connected to a virtual IDE controller cannot be resized but it is possible to move the disk onto a SCSI controller on the same VM using a method I documented - HERE

  26. Daniel
    May 5th, 2011 at 14:53 | #26

    Thanks for this solution!
    A workmade told me, i should use extpart.exe to extend some c:-partitions on windows server 2003 r2, i tryed and it doesn't work. I found your manual, tested to boot the system in save mode and extend the partition and this solved my problem i've had before with the error "Unable to connect to c: or it does not exist".

  27. Joao Roberto
    July 13th, 2011 at 22:27 | #27

    Very tks. This articlle solved my issue. I´d like thanks to Mauro Bonder from Brazil.

  28. Adnan
    July 19th, 2011 at 08:07 | #28

    Thanks Man, Its works for ME !!!

  29. Sandy
    August 18th, 2011 at 20:44 | #29

    Excellent! it worked for me too.

  30. Matt
    August 26th, 2011 at 14:07 | #30

    Awesome! Works like a charm. Does it also work on Dynamic disks?

  31. Matt
    August 26th, 2011 at 18:41 | #31

    @Matt
    Answered my own question by reading the top of the program.. It doesn't. I purchased Dynamic Disk Converter Server Edition - converted my disk and ran this... Got my terminal server back up and running after it was running out of space on the C drive. Thanks!

  32. Alex
    September 13th, 2011 at 09:58 | #32

    @Daniel
    Hi Daniel:
    Maybe you can try to shutdown the "Windows Search" service ,and try again. 🙂

    Alex

  33. David
    October 11th, 2011 at 16:43 | #33

    Stopping the "Windows search" service worked to get rid of the unable to connect message. I am unable to reboot this server without causing major issues, thanks for the tip!!

  34. Ben
    November 2nd, 2011 at 11:26 | #34

    Rather than using a 3rd party tool like ExtPart, why not just use the WIndows tool DiskPart, it's easy, open a cmd prompt, type 'diskpart' then 'list volume' to display a list of your volumes, then type 'select volume X' (where X is the volume you want to extend), then simply type 'extend', and the volume will be extend to the max size possible, or you can use size=n to increase the volume by 'n' megabytes.

  35. anon
    December 22nd, 2011 at 10:49 | #35

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

    I went through all the non essential services one by one and stopped them and it seems the "File Replication Service" was stopping the connection to the C drive for me.

  36. Erik
    January 4th, 2012 at 21:40 | #36

    I needed the vmtools and disk manager turned off. In addition, it was a Citrix server and I needed to turn off the citrix profile service as well.

  37. Alan McCormack
    March 1st, 2012 at 10:56 | #37

    Just a quick note to say thank you very much for this.

    I carried out your instructions on a Windows 7 Enterprise Virtual Machine on VMSphere 4.0 in a live production environment and it worked like a charm. The only extra bit that I had to do was carry out the extpart bit in a command prompt in Safe Mode as it just did not work in Normal mode.

    This is an excellent bit of advice and a clear and concise article and it certainly made the day of my poor VM user who had a 16Gb disk, but now has a much improved 25Gb disk. Keep up the good work!

    Alan

  38. TJK
    July 3rd, 2012 at 14:22 | #38

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

    It looks like there are particular services that may lock the drive from expanding. Some mentioned already are Windows Search and the File Replication Service. I started checking other services and DFS Replication causes this message as well. Once I stopped it, I was able to expand the drive using extpart without rebooting into safe mode.

  39. July 27th, 2012 at 16:29 | #39

    Brilliant....... Love it..... Dell Dell Dell Dell 🙂

  40. Kinou
    August 30th, 2012 at 08:15 | #40

    Was the file replication service for my 2k3 SBS server. Thanks all, great help 🙂

  41. unx
    October 4th, 2012 at 12:40 | #41

    Safe mode for my Windows Server 2003 R2 server works perfectly! Thank you!

  42. hard drive review
    October 24th, 2012 at 13:42 | #42

    Good! Thank you! Just got a brand new tricky drive and was concerned that I
    couldn't sync it from Mac to Windows (The original purpose I purchased it)

  43. JMB
    November 1st, 2012 at 15:14 | #43

    Hey guys, thx for others leading me in the correct direction when it does not connect to c:
    mine was not searc, or vmtools. Mine was the perfectdisk pdengine service.

  44. Een
    November 28th, 2012 at 19:54 | #44

    I was getting the "Unable to connect to c: or it does not exist" error as well. I stopped the Indexing service and it worked like a champ.

  45. mahmoud
    December 3rd, 2012 at 04:44 | #45

    i wand to decrease the volume size. what should i do?

  46. Smartyparts
    December 6th, 2012 at 16:00 | #46

    I found that stopping the "file Replication Service" on my VM eliminated the "unable to connect to c:" error and allowed me to do the expansioin.

  47. Keoni
    December 21st, 2012 at 19:52 | #47

    On win2r3 standard 32 bit. It was 'protected storage' that prevented extpart from seeing C: for me.

*

code