As ESX has matured, extending the size of .vmdk disks has become easier and easier. In ESX 3.5, using the VI client, you can simply edit your VM settings and increase the size of the disk. (or you can use the vmkfstools -X command from your hosts service console, if you prefer command line).
Once you’ve extended the disk, you’ll then want to extend the volumes within the Windows OS. This is easy using the diskpart tool that Microsoft has provided in Windows Server 2003 (the same version also works in Windows 2000, but is not included. Simply copy diskpart.exe from any other Windows Server 2003 machine). The problem here, is that diskpart can only be used to extend volumes that are not boot partitions (OS) and those that do not contain page files. Fear not, there is a solution for extending OS/Boot volumes!
Download Dell extpart
C:\dell\ExtPart>extpart /?
ExtPart – Utility to extend basic disks (Build 1.0.4)
(c) Dell Computer Corporation 2003
Usage: extpart [volume size]
volume – volume to expand. eg. f:, g: etc. (only basic volumes)
size – size in megabytes to expand the volume
Return codes for script mode
(If parameters are not specified extpart will run in interactive mode)
0 – Success
1 – Parameter error. size parameter is invalid
2 – Invalid volume or failed to connect to volume
3 – Invalid volume type or failed to get volume properties
4 – Requested size is invalid or volume expansion operation failed
5 – Unable to retrieve volume properties after expansion completed
6 – Invalid size requested for expansion (minimum value is 8 MB)
Using extpart, as long as there is available disk space directly at the end of your disk (which there should be assuming your OS C: volume lives on it’s own .vmdk, and you’ve extended that .vmdk via the VC console), you can use this tool to quickly and easily extend the volume! Below is an example where I extended an 8GB disk to 10GB.
C:\dell\ExtPart>extpart.exe C: 2048
ExtPart – Utility to extend basic disks (Build 1.0.4)
(c) Dell Computer Corporation 2003
Current volume size : 8181 MB (8578934272 bytes)
Current partition size : 8181 MB (8578934784 bytes)
New volume size : 10228 MB (10725732352 bytes)
That’s all there is to it!
Note 1: Windows Server 2008 allows you to extend OS and Data volume live via the Server Administrator console. (Go to Administrative Tools > Disk Management, Right click the disk you want to extend and then click “Extend Volume”)
Note 2: It is not as easy to shrink a .vmdk disk as it is to enlarge one. The only way I know of doing this today would be to use VMware Converter (or an equivalent tool) to clone your VM and re-size the disks as part of that process.