Tuesday, 22 November 2011

Sysprep and Renaming a VM on VMware

So I dont have to build an OS from scratch each time I want to provision a machine I've been using a Syspreped image, copying it and then renaming it using the VMware console. The procedure is as follows:
Create your Syspreped OS and upload it to a datastore on VMware ESXi/Hypervisor in to a folder called something like 'Master Images'.
Create a copy of the Syspreped image: create a new folder for your new VM with a sensible name then copy just the VMDK file from the Sysprep image to the new folder.
Use the steps 5 to 7 in the following Vmware KB article to rename the VMDK file to something more sensible:
If that link has died since I made this post, the steps were as follows:
6. Navigate to the directory containing the virtual machine. For example: cd /vmfs/volumes/DatastoreName/originalname/.
7. Rename the virtual disk (VMDK) files using the vmkfstools -E command.
vmkfstools -E "originalname.vmdk" "newname.vmdk"
I've tested this on ESXi 4.1.0 and Hypervisor (ESXi 5).