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.