How to resize Windows partitions after VMware disk expansion

If a VMware HDD becomes small, you can enlarge it using vmware-vdiskmanager. Unfortunately you can only expand a virtual disk. If you want to reduce the size of a virtual disk, this disk have to be a "growable" disk which corresponds in vmware-vdiskmanager to "-t 0" or "-t 1". After expanding a virtual disk image with vmware-vdiskmanager and booting Windows, the operating system still shows the outdated small size of the disk. Now you have to tell Windows that the disk partition became larger. There is an onboard tool called "diskpart" which you have to execute with admin privileges to expand a NTFS partition to the full size of the disk. To accomplish this, you have to do the following after calling diskpart from the command prompt or using Windows PowerShell:

list disk

% to show available disks

list volume

% to show available volumes

% now select the corresponding disk and volume; in my case these are disk "0" and volume "0"

select disk 0

select volume 0

% now extend the selected disk; the size parameter is specified in MB

% using the following command, you can extend disk 0 by 666 MB

extend disk=0 size=666

% using the following command, you can extend the NTFS partition to the full size of disk "0"

extend disk=0

Following the steps above you can maximize the usage of a NTFS partition.