Tuesday, March 25, 2008

How to rename Virtual Server

NOTE: If you are renaming any Virtual Machine make sure that there is NO snapshots associated with the server.


A. Change name in Windows OS:
Logon to the Virtual Server
Open system properties and then select "Computer Name"
Hit change and then supply new name of the server.
It will ask for reboot, but cancel this and shut down the machine.

METHOD1 :

B. Change name on VMware Host:

Unregister the virtual server in Virtual Center: right-click on server name, select Remove.
Using an SSH client, connect to the VMware Host Service Console where the VM resides.
Rename the Virtual Server's Home Directory any drives associated with the Virtual Server

cd /vmfs/volume/"LUN of Virtual Server"
sudo mv "oldservername" "newservername"
cd "newservername>"
Now rename all the file as shown in the pic. To rename the file use the following command

sudo mv "old file name" "newfile name"



After the rename the file should look like




PS: Here we are renaming server from NTDBPH2057M00 to NTAPPH2057M00

4. Update the descriptor file for each disk . In the above example the file would be ntapph2057m00_1.vmdk and ntapph2057m00.vmdk. Use VI or SCP to edit the file .You will find following entry RW 25165824 VMFS "ntdbph2057m00-flat.vmdk" and this need to be changed to RW 25165824 VMFS "ntapph2057m00-flat.vmdk"

5. Update the .vmxf file . In above example we have to update ntapph2057m00.vmxf. There will be something like ntdbph2057m00.vmx. Update the server name here

6. Update the file .vmx . In the above example we have to change following lines
nvram = "ntbph2057m00.nvram"
displayName = "ntdbph2057m00"
extendedConfigFile = "ntdbph2057m00.vmxf"

and remove following lines from the VMX file
migrate.hostlog = "./ntdbph2057m00-63889e62.hlog"
sched.swap.derivedName = "/vmfs/volumes/47963ca5-78df4610-1696-01a4bbe0612/ntdbph2057m00/ntdbph2057m00-63889e62.vswp"

7. Register the vmx file with the host and for example
sudo vmware-cmd -s register /vmfs/volumes/vmsan-p21-416/ntapph2057m00/ntapph2057m00.vmx.
8. VM with the new name should be avilable under Virtual Center. Edit the setting for the VM’s and point it to the correct Hard Disk. Make sure you remove the Hard Disk and then re—add them back.

9. Power On the machine and it will ask to confirm if you have to create a new identifier. Create a new one. VM will power on if every thing has been setup correctly

METHOD2 :

  1. Shut down the virtual machine.
  2. Rename the virtual machine inside the VC by right click and select rename.
  3. Once you are done with rename migrate this virtual machine to a different lun.
  4. As this machine move to different lun it rename all the required files which has been described in above steps.

No comments: