I see a lot of environments where the Virtual Machine (VM) disk space must be extended.
Prior ESX 3.5 the way to extend a VDMK was to use the vmkfstools command with the -X parameter from the VMware ESX server console. With the coming of ESX 3.5 it is possible to extend the VMDK file when the VM was shutdown. Now with VMware ESX 3.5 Update 2 it is possible to online (hot) extend the VMDK file.
In the Virtual Infrastructure Client (VIC) go to the VM and edit the settings, click on the disk there is a property New Size (figure 1).
Figure 1. The VM disk extend function
The first step is to see if there is enough free space on the LUN (datastore). You can check the disk space (realtime) by using the command vdf -h on the ESX server console or in a SSH session. Keep in mind to have a average of 10% free on the LUN for snapshots and swap files etc.
If the disk space on the LUN is okay you can extend the disk. In this example we extend the 16GB disk to 20GB.
Figure 2. The VM disk extend function
When the VMDK is extended the disk space must be added to the Windows volume. In the Windows Disk manager when using VMware ESX 3.5 Update 2, use the “Rescan Disks” function to discover the new added space when you use the hot extend function. The new added space is seen as Unallocated
Figure 3. Windows disk manager
To extend the volume by using diskpart use the following commands:
- Start – run – type diskpart
- type list volume
- type select volume 1
- type extend When trying to extend the C partition with diskpart you got the following message “The volume you have selected may not be extended”
Figure 4. Diskpart tool
It is not possible to extend the system- and bootvolume by using the diskpart built-in command (for MS Vista, Windows 7 and Windows 2008 and higher you can extend the volume by using diskpart). For MS Windows XP and MS Windows 2003 there are other options you can use:
- Add the system- and bootdisk volume to the other Virtuele Machine (VM) as disk. Start the other VM and use the diskpart command to extend this disk or use an 3e party partition tool.
- Use the command line tool from Dell called Extpart. Usage: expart [drive] [sizetoextend]
- Use the Gparted tool. You can download the ISO file from here. When the download completes upload the ISO file to your storage and attach and connect the ISO the to the VM.
Figure 5. Connect the ISO file to the VM
Start the VM, the ISO gets started
Figure 6. Start the Gparted tool
– Press Enter
Figure 7. Keymap choice
– Press OK
Figure 8. Keyboard layout
– Select your keyboard layout
Figure 10. X-windows graphical warning
– Press Enter
Figure 11. GParted Parition tool
– The partition layout is displayed. Select the disk the extend and press Resize/Move
Figure 12. Partition resize window
– Enter the new size or drag the bar the the right and press the Resize/ Move button
Figure 13. Partition resize
– Click the Apply button
Figure 14. Partition resize warning
– Press Apply
Figure 15. Partition resize process
– If the extending process completes and is successfully, restart the system and disconnect the ISO from the VM and restart the VM.
Figure 16. Windows Disk Manager
– After the restart open the Windows disk manager and you see the new space is added to the volume.
How about when the the VM is the VC itself. Is it still possible to use Gparted?
Yes you can. Make a direct connection using the VIC to the ESX server that host the VC. Connect the ISO and boot the VC server from it.
There is a much easier way: http://ftp.dell.com/app/ExtPart.exe
This will expand the C: volume instantly without
errors. It’s written for Dell Poweredge servers
but works flawlessly in VM’s as well. Just used
it on a Windows 2003 VM.
Thanks Guido for sharing!
Thanks Guido! I’ve been trying to remember that thing for two days now. I’ve used it in the past, and it’s far and away the best utility for this I’ve seen.
Thanks Guido! Unfortunately ExtPart does not work on x64 servers 🙁
I’ve been pulling my hair out trying to get the boot drive on one of my servers to expand. Thanks Guido, your post was a life savor!
Thanks for post. Nice to see such good ideas.
Thanks…this got a lot more room for my Exchange 2007 server.
Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.
Thanks , This was helpfull, although gnome never work for me , I had to use acronis disk director server
I have just found an alternative way to do this that also covers vSphere. You dont even have to reboot your VM!
http://www.jjclements.co.uk/index.php/2009/09/14/vmware-esx-vsphere-resize-disk
I just tried using ExtPart on Windows 2008 R2 and of course it didn’t work due to ExtPart being 32-bit and 2008 R2 being 64-bit. So I tried diskpart anyway (expecting it to fail) and it worked! Instantly extended a 40GB boot/system partition up to 100GB without a restart. 🙂
Thanks I have always used diskpart and it took forever this was quick and simple to use.
gparted is included in the latest R2 release of Bauer-Puntu Linux.
You may wish to download and try fatvm (http://www.gudgud.com/fatvm). You can extend a Windows vmdk with a single-click through its UI.
wow, Guido.. what a life saver!!! After 2 hours fighting with partition magic and GNOME boot.. it was a small miracle to see Drive Management partition expand after typing 5 letter command.. I could not believe my eyes.. I read 12 KBs on the subject from MS, did not find how to make their utility work.. why wouldn’t they include this little thing with server 2003? THANKS AGAIN!!
Why would you want to install third party software when you can extend a vmdk through Windows 2003 svr? I’m not sure I understand this post!?
In the original post it says:
“It is not possible to extend the system- and bootvolume by using the diskpart built-in command. There are other options you can use:
– Add the system- and bootdisk volume to the other Virtuele Machine (VM) as disk. Start the other VM and use the diskpart command to extend this disk or use an 3e party partition tool.”
So I did exactly that, I shutdown the vm who’s boot partition I wanted to extend (lets call him vm1), added that vmdk to vm2 and booted vm2. In order for diskpart to let me extend the vmdk of vm1 I had to assign it a drive letter. So I did that and then extended the volume without any issue. I then powered off vm2 and disconnected the vmdk for vm1. Then, when I started back up vm1 I got this error:
“Windows could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM
You can attempt to repair this file by starting Windows Setup using the original Setup CD-ROM.
Select ‘r’ at the first screen to start repair.”
Did I do something wrong? Why would I get this? Why didn’t anyone else in this thread run into this?
I’m running vSphere 4.0 and vm1 and vm2 are both w2k3 x64 VMs.
Any info / help as to why I ran into this issue (this is the second time I’ve run into this issue) as well as any resolution on how to fix it would be greatly appreciated!
Thx!
Clone VM1 and call it VM2. Follow through the same steps and see whether you still get the same problem.
Is VM1 a clean install of w2k3 x64?
The .ISO would not boot. Tried attaching it to several VMs, forcing connected/connect at power up but it is ignored. Was really hoping this would work.
I use VMware Workstation 8, I follow this tutorial (http://www.partition-magic.org/vmware/expand-vmware-disk-partition.html to expand VMware disk successfully.
Wow… Just had a single partition system VMDK to extend and was looking like I’d have to do ISO boot jiggery pokery or perhaps even purchase some software then I found ExtPart details here. wow… a 37k exe from 2003 did the job in less than 1 sec. Kudos for sharing this dudes… one for the utils folder for sure 🙂
Cheers
Gaz
Exactly what I needed for Windows 2003 virtualbox image. cheers