tkutil,
Depends on the operating system installed in the template. From the command line of one of your ESX hosts you can use vmkfstools to expand the VMDK:
vmkfstools -X50G mynewmachine.vmdk
will expand your VMDK to 50GB. That will only expand the underlying virtual disk - not the filesystem on the virtual disk.
For Windows VMs we use Windows PE as a loading mechanism and we can PXE boot the VM and use diskpart to extend the filesystem even on the system partition (i.e. the C:\ drive) of a Windows VM. One could also use BartPE I would assume.
Here's our process to extend to 50GB for a Windows-based OS:
. Deploy new VM from template
. vmkfstools -X50G newmachine.vmdk
. Boot to WinPE and get to a command prompt
. Run diskpart and run the following commands at the diskpart> prompt
. select disk 0
. select partition 1
. extend
For Linux, it would depend on the distro. On RedHat/Fedora-based distros with the root filesystem on a Linux LVM logical volume the process would be basically the same first 2 steps above then:
. Create a new physical partition with fdisk
. Change the partition type to Linux LVM (partition type 8e)
. Boot into Linux
. pvcreate on new partition
. vgextend onto new physical partition
. lvextend current logical volume
. resize2fs the current filesystem on the logical volume to the new size.
I leave other OSs as an exercise for the reader ![]()
Hope this helps.
EDIT: you have to boot to PE or some other offline OS to extend the system partition on Windows because you're not supposed to be able to extend the system partition.