This articles provides steps for renaming an ESX/ESXi virtual disk using the vSphere Command Line Interface (vCLI) or the console interface on an ESX/ESXi host.
Note: The vCLI is available pre-installed within the vSphere Management Assistant. For more information, see the vSphere Management Assistant Documentation. and vSphere Command-Line Interface Documentation.
For more information on renaming a virtual machine and its files, see Renaming a virtual machine and its files in VMware ESXi and ESX (1029513).
A virtual disk above consists of two files:
examplevm.vmdk
examplevm-flat.vmdk
A virtual machine's files can be listed and manipulated using the vSphere Command-Line Interface or the console interface on an ESX/ESXi host. For example, the descriptor and extent files can be seen using the vCLI vifs
command:
Prior to renaming a virtual disk, you must meet these prerequisites:
Note: Always ensure you have a backup of all virtual machines. For additional information, see Backing up ESX Server virtual machines with ESX 2.x (1355).
For documentation on using the vCLI or vMA, see the vSphere Command-Line Interface or vSphere Management Assistant documentation.
To rename the disk and its files using the vmkfstools
command in the vMA or vCLI:
Disk File
field at the top-right. vifs.pl --server -D "[Datastore Name] VM_Directory Name"
vmkfstools.pl --server -E "[Datastore Name] VM_Directory Name/examplevm.vmdk" "[Datastore Name] Directory Name/examplevm-renamed.vmdk"
vifs.pl --server -D "[Datastore Name] Directory Name"
To rename the disk and its files using the vmkfstools
command in ESX/ESXi host's console interface:
Disk File
field at the top-right. cd "/vmfs/volumes/Datastore Name/Directory Name/"
ls -l
total 320
-rw------- 1 root root 8684 Aug 30 10:53 examplevm.nvram
-rw------- 1 root root 21474836480 Aug 30 10:26 examplevm-flat.vmdk
-rw------- 1 root root 482 Aug 30 11:26 examplevm.vmdk
-rw------- 1 root root 0 Aug 30 10:33 examplevm.vmsd
-rwxr-xr-x 1 root root 2724 Aug 30 12:20 examplevm.vmx
-rw------- 1 root root 264 Aug 30 12:20 examplevm.vmxf
-rw-r--r-- 1 root root 39168 Aug 30 10:53 vmware.log
vmkfstools -E OldName.vmdk NewName.vmdk
vmkfstools -E examplevm.vmdk examplevm-renamed.vmdk
ls -l
total 320
-rw------- 1 root root 8684 Aug 30 10:53 examplevm.nvram
-rw------- 1 root root 21474836480 Aug 30 10:26 examplevm-renamed-flat.vmdk
-rw------- 1 root root 482 Aug 30 11:26 examplevm-renamed.vmdk
-rw------- 1 root root 0 Aug 30 10:33 examplevm.vmsd
-rwxr-xr-x 1 root root 2724 Aug 30 12:20 examplevm.vmx
-rw------- 1 root root 264 Aug 30 12:20 examplevm.vmxf
-rw-r--r-- 1 root root 39168 Aug 30 10:53 vmware.log