Friday, November 8, 2013

vmware disk rename

sometimes you need to do this.

yeah

Renaming using the virtual disk using the ESX/ESXi host console interface

To rename the disk and its files using the vmkfstools command in ESX/ESXi host's console interface:

Verify the virtual machine referring to the virtual machine disk is powered off and does not have outstanding snapshots.

Remove the virtual disk from the virtual machine's configuration:

Locate the virtual machine in the inventory using the vSphere Client.
Right-click the virtual machine select Edit Settings.
Select the virtual disk in question and take note of virtual device node (eg, SCSI 0:1) and the name of the datastore and directory in the Disk File field at the top-right.
Click the Remove button to disconnect the virtual disk from the virtual machine.

Open a console to the ESX or ESXi host. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807) or Using Tech Support Mode in ESXi 4.1 (1017910).

Navigate to the virtual machine's directory using a command similar to:

cd "/vmfs/volumes/Datastore Name/Directory Name/"

Obtain a listing of the files within a directory using the command:

ls -l

For example:

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

Rename a virtual disk using a command similar to:

vmkfstools -E OldName.vmdk NewName.vmdk

For example:

vmkfstools -E examplevm.vmdk examplevm-renamed.vmdk

Note: Specify the descriptor file; the associated extent file is renamed 
in the process.

Validate the files were renamed by listing the files within the directory 
using the command:

ls -l

For example:

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

Re-add the virtual machine disk to the virtual machine's configuration.

Using the vSphere Client, select the virtual machine and click Edit Settings.
Click the Add... button above the virtual hardware list.
Select Hard Disk and Use an existing virtual disk.
Select the datastore and disk that was renamed.
Confirm that the same SCSI controller type and Device Node noted in step 2c.
Click the OK button to complete the configuration change.

No comments: