October 10, 2021

VMware: Extending a Cloned (Deployed) Windows VM’s root partition without using any 3rd party tools

In the dynamic environment we have at work any day of the week, we could need some test VM’s with any number of different disk sizes.

I would clone a “Golden Master” and then resize the disk, going through many different tools to be able to resize the C: drive to the full size of the .vmdk.

So, I wondered if there was any way to automate this. Well, there partially is.

If you add the “ExtendOEMPartition = 1” entry to the sysprep.inf file that VMware “drops off” on the vmdk before the customization process, it will resize to the full size (within the limits of the Windows OS you are cloning).

Keep in mind, this doesn’t work for shrinking, but it certainly does for extending.

So my task was to deploy a VM, resize the disk, and have the customization process extend to the new (bigger) .vmdk size.

Well, after some deductive reasoning, I figured out which file generated the sysprep.inf. I wasn’t so concerned with the “dropping off” process, as I was the generation process.

If this file is modified, to include the “ExtendOEMPartition = 1” entry in the [Unattended] section, the magic will happen. That is if you extend the .vmdk before the VM powers on for the first time.

Now, the modifications aren’t difficult by any means. I will mention however, that the files to be modified are encoded, and they will have to be decoded. I will not go through the process of decoding them. But once decoded, you should be good to go.

And as everyone else who posts tweaks/ enhancements/ mods/ etc., I cannot be held responsible (or liable) for any changes you make to your configuration or your environment.

Click here to download the paper I put together. (Apparently my provider is having some web issues, possibly compression or something, so I’ve changed the .pdf to a .zip link. I’ll post the whole article as a web page to help with this issue.)

I’ve tested this in VC 1.4 with ESX 2.5.x and VC 2.0 with ESX 3.0.0 and it works successfully with Windows 2000 and Windows 2003 guests. Updated: VC 2.0.1 and ESX 3.0.1 also perform flawlessly.

Another note: The mentioned files only have to be modified once. They will not affect the normal cloning/template deployment process if you do not resize the .vmdk’s. I would recommend that if you upgrade your VC install, you check these files, and potentially update them if they have been replaced.

9 thoughts on “VMware: Extending a Cloned (Deployed) Windows VM’s root partition without using any 3rd party tools

  1. Great acrticle! But what is about ESX3.5/VI2.5? Where can i find the gensysprepinf.vbs etc. when i don’t want to use my own sysprep.inf? Thx Timm

  2. This article was written before VirtualCenter 2.5 came out.

    It only works for VirtualCenter 1.x and 2.0.x.

    I haven’t had the opportunity to look at it for VirtualCenter 2.5 as of yet.

  3. I have added a post on the vmware communities about vc2.5 lets see what happens.

    Trigsy

    p.s. nice article will get me out of a pickle now and then.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.