Posts Tagged ‘vmdk’

VMware ESX: Renaming a Virtual Disk

Sunday, September 20th, 2009

A VMware virtual disk is made up of two files, the disk descriptor (<name>.vmdk) and the disk content itself (<name>-flat.vmdk). Using Virtual Center, you can move virtual disk files around (i.e. folder to folder), but it will not let you rename them. To do this you have two options: mv or vmkfstools.

Using mv:
SSH to the ESX host, cd to the location of the virtual disk. Oh, if the disk was attached to a VM, that VM needs to be powered off. Type:
mv oldname.vdk newname.vmdk
mv oldname-flat.vmdk newname-flat.vmdk

Next, need to edit the descriptor file so it can locate the disk (you can use vi, pico, nano):
vi | pico | nano newname.vmdk – Locate the old name in the file and edit to match the new name. Write out the file.

Using vmkfstools:
vmkfstools can rename the files and update the descriptor all at once (command is all on one line):
vmkfstools -E /vmfs/volumes/path/to/oldname.vmdk
/vmfs/volumes/path/to/newname.vmdk

Finally, if the disk was attached to a VM, back in Virtual Center (or by editing the .vmx for the VM) edit settings for the VM and point it to the newly renamed virtual disk. You can then power on the VM.