Follow Me Icons


Follow @KendrickColeman on TwitterConnect on LinkedInWatch My Videos on YouTubeFollow me on FacebookCheck Out My Projects on GitHubStay Up To Date with RSS


BSA 728x90 Center Banner

How to extend the OS partition of a Virtual Machine Drive (VMDK) if it contains 2 or more partitions

How to extend the OS partition of a Virtual Machine Drive (VMDK) if it contains 2 or more partitions

Before we begin, this is all done with VMWare ESX 3.5 and you need to have an ISO of GParted.

Last night I was given the task to extend the Operating System (C:) drives of a few virtual machines because we ran out of room for Windows patching. This is a relatively easy task. Shutdown the VM, extend the disc a few GB under edit settings of the VI Client, boot into GParted, resize, apply, and reboot. Bam, you're done. Well, let me throw this scenario at you. Someone before you did a P2V (Physical to Virtual) of a server that had 2 physical hard drives and during the process didn't hit that little checkmark to create 2 seperate virtual hard drives (VMDKs). Instead, you are left with one large hard drive with 2 partitions. Windows still functions as it did when it was physical, having 2 seperate hard drives, for this instance we will say C: & E:. Since the Operating System partition is at the beginning of the drive, you can't move it to the end and extend it because that would screw up the MBR (Master boot record).


Disclaimer: Before I did any of the following I created clones of the VMs because you will have to move and delete partitions. This is a safety measure I would recommend. DO NOT CREATE A CHECKPOINT. DELETE ALL CHECKPOINTS. Checkpoints will not allow you to mess with partitions.

Here is how to get around this obstacle.

1. Open the console to your VM and get the sizes of your drives. In this instance we will say C: is 8GB and E: is 20GB.
2. Shutdown your VM and go to "Edit Settings"of the VM in the VI Client. You will see only 1 hard drive, and in this case it's 28GB in size
3. Add a new Hard Drive and make the size 20GB
4. Mount the GParted ISO under the DVD/CD-ROM and make sure "Connected" is checked
5. This step is optional because its hard to press F11 to boot to CD on the console when you are doing this remotely

  1. Under options -> go to boot -> and click the tick that says "boot into bios"

6. Click OK and allow the settings to take place
7. Open up the console and power on the VM. If you skipped step 5, you need to be pressing F11 so you can boot to disc. If you didn't skip step 5, then you are presented with the BIOS, change the boot order to boot to CD first. Press F10 to save and exit
8. Boot into GParted
9. Copy your E: Drive (20GB partition) and Paste it to the new drive. Extend it to the end of the disk and Click Apply. This can take anywhere from 2 minutes to an hour depending on how large your drive is and how much data must be copied over to the new drive.
10. Go back to your original drive and delete the E: drive partition of that disk. Once that is done you will see a large amount of "Unallocated Space". Resize your Operating System and extend it all the way to the end of the disk. Click Apply and this should be finished in 2 minutes. You now have an OS drive 28GB in size.
11. Reboot the VM and remove the ISO so it doesn't boot back into GParted
12. Windows will boot and do an integrity check of both partitions
13. Once the VM boots back into windows it will detect the new hard drive, but nothing else has changed. When you copy the partition, it moves all the permissions, name of the volume, etc. so everything is back to the way it was. You're done!


Related Items