One tasks that frequently comes up in IT is adding more disk space to a server. In a Windows VM environment, for the most part, this is very easy. If your disks are Basic as opposed to Dynamic, simply add more space to the VMDK file via VMware and then use diskpart to extend the partition. If your disks are dynamic, create a new virtual disk in VMware and in Windows span onto this new disk.
Unfortunately, neither of these two scenarios work if you are trying to add space to the C: drive. Diskpart will not extend a partition that contains the boot volume, a.k.a. C:. If your C: drive is dynaimic, you cannot span the C: drive with multiple disks.
One solution assuming you are using Basic disks is to
- Shutdown your VM
- Remove the virtual disk from the VM configuration. (DON’T DELETE IT)
- Add this virtual disk to another VM
- Increase the virtual disk size using VMware
- Use diskpart in the VM to extend the partition
- Remove the virtual disk from the temporary VM
- Add the VM back to the original VM and boot
There are a couple of problems with this method
- It assumes you have a spare VM to work with
- It assumes that you don’t mind making changes to the temporary VM even if the changes are minor
There is a better way to do the C: drive expansion that is a bit faster and sidesteps the problems listed above. Parted Magic is the secret sauce. Pmagic is an opensource, Linux distribution that includes many easy to use disk based utilities including gparted, a disk partition utility.
Requirements:
- Basic Disks. (It may work with Dynamic. I have never tried)
- A Backup of your data specifically the vmdk file you are modifying. I highly recommend using FastSCP from Veeam. This is a free tool that is easy to use and can make fast backups of VMDK files
- Parted Magic Live CD
Steps:
- Shutdown your VM
- Backup your VMDK file. Do not rely on just a snapshot. Since we are making major changes to the partition table of the vmdk file a full backup is recommended. A snapshot will probably work but not recommended.
- In VMware Infrastructure Client, increase the size of the virtual disk
- Mount the Pated Magic Live CD in your VM
- Boot the VM into the Pmagic OS
- Start the Gparted Application. There should be an icon on the desktop. In the screenshot you can see the C: drive with the additional 40GB of unallocated space. The drive designation is in Linux parlance, i.e. it is now /dev/sda1 and not C:
-
- Click Resize/Move
- Simply drag the green box representing the first partition so that it fills the entire drive
-
- Exit gparted and apply your changes. After churning for a few moments you should see a success screen
-
- Shutdown the VM. The equivalent Windows “Start Button” is in the lower left hand corner
- Unmount the Pmagic CD
- Boot the VM. Windows will immediately complain that changes have been made to the system that require chkdsk to run. Let chkdsk run. The machine may reboot after this is complete.
- Login and check that Windows sees the larger C: drive.
Comments