Wednesday, 1 August 2012

How to uninstall vCenter Server Agent from ESX/ESXi host

ESX

  • SSH into the host
    • Stop the vCenter agent process.  –>service vmware-vpxa stop
      • This also sometimes completed right away, and other times, just took more time than it should have.
    • Stop the hostd process.  –> service mgmt-vmware stop
      • At this point, typically the host would finally disconnect from vCenter, if it hadn’t already completed the disconnect process issued earlier.
    • Delete the user account vCenter uses to communicate with the host.  –> userdel vpxuser
    • Find all of the vCenter and HA processes.  –> rpm -qa |grep -iE ‘vpx|aam’
    • Delete the RPM’s found earlier –> rpm -e
    • Start the hostd process. –> service mgmt-vware start
  • Now that’s all done.  Go back into vCenter and reconnect the host.

ESXi

ESXi is a slightly different beast.  Since it doesn’t use a Red Hat based service console, there are no RPM’s to remove as was done above.  To remove the agents from ESXi:
  • SSH into the host
    • Delete the user account vCenter uses to communicate with the host.  –> userdel vpxuser
    • Move into the uninstaller directory –> cd to /opt/vmware/uninstallers
    • Remove the HA/aam agent –> ./VMware-aam-ha-uninstall.sh to
    • Remove the vCenter agent –> ./VMware-vpxa-uninstall.sh to
  • Now that’s all done.  Go back into vCenter and reconnect the host


Friday, 25 May 2012

In ESXi 4 how to create local user account and allow them to login as Root User

Please follow the below steps to Create Local Users in  ESXi 4.1

Step 1:  Login to the ESXi Server using Remote Tech Support with root user credentials
Step 2: Create a local user with the below command

# useradd rajas

Step 3: By default local user account created will not be presented shell access. Hence change the shell using below commands

#usermod -s /bin/ash <username>
#usermod -s /bin/ash rajas

Step 4: By default home directory for local users will not be created. Please create a home directory for user using below commands.

#mkdir -p /home/<username>
#mkdir -p /home/rajas

Step 5: change the ownership of the home directory as below

#chown rajas /home/rajas

Step 6: U can login with rajas account credentials but need to switch over to root user to perform special functions

Step 7: How to directly acquire root access while login with local user credentials

#vi /etc/passwd

dcui:x:100:100:DCUI User:/:/sbin/nologin
vpxuser:x:500:100:VMware VirtualCenter administration account:/:/sbin/nologin
rajas:x:5001:100:ESXi User:/home/rajas:/bin/ash

change the last line as below
rajas:x:5001:100:ESXi User:/:/bin/ash

Step 8: Try login with rajas credentials and execute pwd command to see the path
 










Tuesday, 1 May 2012

how to configure virtual switch using command line interface

Recently i added a DvSwitch and added 3 of my hosts to the dvswitch. But unfortunately i lost network connectivity to the ESX hosts.

Did following steps to revert back the changes

Both the physical nics vmnic0 and vmnic1 are mapped to dvswitch.

Step 1: Removed vmnic0 and vmnic1 from the dvswitch
 Syntax: esxcfg-vswitch -Q vmnic0 -V <port id> <portgroup name>

#esxcfg-vswitch -Q vmnic0 -V 216 "AMB 01"
#esxcfg-vswitch -Q vmnic1 -V 217 "AMB 01"

Vmkernel interface also mapped to dvswitch

Step 2:  Remove vmkernel interface from dvswitch

Syntax: # esxcfg-vmknic -d -s <DVswitchname> -v <virtual_port_ID>

#esxcfg-vmknic -d -s "AMB 01" -v 100

Step 3: Mapped vmnic0 to vswitch0

#esxcfg-vswitch -A vmnic0 vSwitch0
#esxcfg-vswitch -A vmnic1 vSwitch1

Step 4: Added vmkernel port to standard switch 


Syntax:#esxcfg-vmknic -a -i <IP Address> -n <netmask> <Portgrp name>


#esxcfg-vmknic -a -i 10.2.1.211 -n 255.255.255.0 "Management Network"


Step 5: How to remove vmkernel port from portgroup 


#esxcfg-vmknic -d "VM Network"



http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1000266

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1008127



Thursday, 19 April 2012

How to convert a thick provisioned disk to thin provisioned disk

If you created a virtual machine with Thick disks and want to convert it to thin provisioned disk please follow the below steps

Step 1 : Power off the virtual machine
Step 2 : Using putty login to the ESX/ESXi server console
Step 3 : Go the virtual machine directory where the virtual machine files are stored
Step 4 : Backup the virtual machine configuration file
Step 5 : Using vmkfstools command convert the thick disk to thin disk

# vmkfstools -i <thickdisk.vmdk> -d thin <newname.vmdk>

Once executed thick disk will be cloned to thin disk. After this process completed u must see two disk created with the newname ie (newname.vmdk and newname-flat.vmdk)

Step 6 : Open the virtual machine configuration file using vi editor
Step 7 : Locate for the old vmdk file name in virtual machine configuration file and replace it with new vmdk file
Step 8 : Make sure u are able to power on the virtual machine without any issues.
Step 9 : Then delete the old vmdk files

Tuesday, 17 April 2012

How to rename a Virtual Machine and its Files

Renaming virtual machine files in-place using the console

Warning: Before proceeding, ensure that:
  • The virtual machine has a current backup and that it has been powered down.
  • The virtual machine does not have snapshots or virtual disks shared with other virtual machines. 

 

To manually rename the virtual machine's files:

  1. Log in to VMware vSphere Client.
  2. Locate the virtual machine in your host inventory.
  3. Power down the virtual machine.
  4. Right-click on the virtual machine and click Remove from inventory.
  5. Open a console to the ESX or ESXi host
  6. Navigate to the directory containing the virtual machine. For example: cd /vmfs/volumes/DatastoreName/originalname/.
  7. Rename the virtual disk (VMDK) files using the vmkfstools -E command.                                                        # vmkfstools -E "originalname.vmdk" "newname.vmdk"
  8. Copy the virtual machine configuration file (.vmx) using the command:
    # cp "originalname.vmx" "newname.vmx"

  9. Open the file new virtual machine configuration (for example, newname.vmx) in a text editor. For more information, see Editing configuration files in VMware ESX (1017022).

    For example:


    # vi "newname.vmx"

  10.  Within the configuration file, modify all old instances of the virtual machine's file names to the new file names. There should be at least these to adjust:
    nvram = "newname.nvram"
    displayName = "
    newname"
    extendedConfigFile = "
    newname.vmxf"
    scsi0:0.fileName = "
    newname.vmdk"[...]
    migrate.hostlog = "./
    newname-UUID.hlog"
    Repeat this process for each virtual machine disk. For example:
    scsi0:1.fileName = "
    newname_1.vmdk"
    scsi0:2.fileName = "
    newname_2.vmdk"
    Correct the VMkernel swap file reference. For example:
    sched.swap.derivedName = "/vmfs/volumes/DatastoreUUID/newname/newname-UUID.vswp
    Note
    : Be sure to rename both the .vswp file and the directory name for the swap file, bolded above.
  11. Correct any other remaining lines referencing the original path or file names.
  12. Save the file and exit the editor.
  13. Rename all the remaining files, except for the.vmxconfiguration file, to the new names desired.

    For example:

    # mv "originalname.nvram" "newname.nvram"
  14. Change directory to the parent directory:
    # cd ..

  15. Rename the directory for the virtual machine:
    # mv "originalname" "newname"
  16. Using VMware vSphere Client, browse the datastore and navigate to the renamed virtual machine directory
  17. Right-click on the virtual machine's new configuration file (for example, newname.vmx) and choose Add to inventory.

    Alternatively, you can use this command to inventory the virtual machine:

    # vmware-cmd -s register "/vmfs/volumes/DatastoreName/newname/newname.vmx"

  18. Power on the virtual machine.
  19. A question for the virtual machine displays in the Summary tab during power-on. Review the question by:
    • Clicking the Summary tab
    • Right-clicking the virtual machine in your inventory and selecting Answer question.

      When prompted, select I moved it, then click OK.

      Warning: Selecting I Copied It results in a change of the virtual machine's UUID and MAC address, which may have detrimental effects on guest applications that are sensitive toward MAC address changes, and virtual machine backups that rely on UUIDs.

  20. Optionally, delete the original virtual machine configuration file.

    For example:
    # rm /vmfs/volumes/DatastoreName/newname/originalname.vmx

How to Enable syslog on ESX

All ESX/ESXi hosts run a syslog service (syslogd) which logs messages from the VMkernel and other system components to a file. 
 
Note: In ESX, you must modify the remote host option in the /etc/syslog.conf file. The rempte host options are:
  • Log file path – Specifies a datastore path to the file where syslogd logs all messages.
  • Remote host – Specifies a remote host to which syslog messages are forwarded. To receive the forwarded syslog messages, your remote host must have a syslog service installed.
  • Remote port – Specifies the port used by the remote host to receive syslog messages.
     
    Resolution:
     
    To log events from an ESX host to a remote syslog server:
    1. Log in to the ESX host as root using an SSH client.
    2. Open the /etc/syslog.conf file using a text editor.
    3. Add this entry at the end of the file:
      *.*     @<IP_address_of_syslog-server>
      For example:
      *.*     @192.1.68.1

    4. Restart the syslog daemon using the command:
      service syslog restart
    5. Run this command to check if the ESX firewall has been opened for the syslog traffic:
      esxcfg-firewall -q|grep syslog
      If the firewall is open, you see an output similar to:
      syslog              : port 514 udp.out
      If the firewall is closed, you do not see any output.
    6. To open the firewall on the ESX host for syslog traffic and to refresh the firewall, run this command:
      esxcfg-firewall -o 514,udp,out,syslog && esxcfg-firewall -l
     

Thursday, 29 March 2012

How to upgrade from ESX 3.5 to ESX 4.1

U cannot upgrade an ESX server From ESX to ESXi

In order to upgrade an ESX server from Version 3.5 to Version 4.1, u need to perform 2 steps to achieve this.

Step 1: Upgrade the ESX Server from Version 3.5 to ESX 4.0 then
Step 2: Upgrade the ESX Server from Version 4.0 to ESX4.1

For First Step we can use VMware Host Update Utility which comes with VMware Vsphere Client 4.0

Pre-requisites:

VMware Vsphere Client 4.0 with Host Update Utility
VMware Vsphere ESX 4.0 ISO image

Action Steps:

1. Install VMware Vsphere Client 4.0 on Vcenter server or any windows server that have access to your ESX server. While installing please check the vmware host update utility check box to install the same.

2. Store the ESX 4.0 ISO image on Vcenter server or any windows server.

3. Shutdown or move the virtual machines running on that ESX host to another ESX host.

4. Bring the ESX server to maintenance mode

5. Launch the VMware Host Update Utility --> click on Add new Host --> enter the IP address or domain name --> Click on Upgrade Host  --> Browse the ISO image then click on Next -->Accept the License Agreement --> Provide the credentials of the server to upload the iso image to ESX Server -->

6. Click on Finish to upgrade the Server