Tuesday 18 September 2012

Setting the number of cores per CPU in a virtual machine

This situation occurs when u add 8 vCPU's to your Windows 2008 Standard 64 Bit Virtual machine, but inside the guest operation system u will see only as 4 CPU's.

Reason:

Some operating system SKUs are hard-limited to run on a fixed number of CPUs. For example, Windows Server 2003 Standard Edition is limited to run on up to 4 CPUs. If you install this operating system on an 8-socket physical box, it runs on only 4 of the CPUs. The operating system takes advantage of multi-core CPUs so if your CPUs are dual core, Windows Server 2003 SE runs on up to 8 cores, and if you have quad-core CPUs, it runs on up to 16 cores, and so on.
 
Virtual CPUs (vCPU) in VMware virtual machines appear to the operating system as single core CPUs. So, just like in the example above, if you create a virtual machine with 8 vCPUs (which you can do with vSphere) the operating system sees 8 single core CPUs. If the operating system is Windows 2003 SE (limited to 4 CPUs) it only runs on 4 vCPUs.
Note: Remember that 1 vCPU maps onto a physical core not a physical CPU, so the virtual machine is actually getting to run on 4 cores.
 
 
This new setting, which you can add to the virtual machine configuration ( .vmx) file, lets you set the number of cores per virtual socket in the virtual machine.
To implement this feature:
  1. Power off the virtual machine.
  2. Right-click on the virtual machine and click Edit Settings.
  3. Click Hardware and select CPUs.
  4. Choose the number of virtual processors.
  5. Click the Options tab.
  6. Click General, in the Advanced options section.
  7. Click Configuration Parameters.
  8. Include cpuid.coresPerSocket in the Name column.
  9. Enter a value (try 2, 4, or 8) in the Value column.
    Notes: Ensure that the number of vCPUs is divisible by the number of cpuid.coresPerSocket in the virtual machine. That is, when you divide the number of vCPUs by the number of cpuid.coresPerSocket , it must return an integer value. For example, if your virtual machine is created with 8 vCPUs, coresPerSocket can only be 1, 2, 4, or 8.

    The virtual machine now appears to the operating system as having multi-core CPUs with the number of cores per CPU given by the value that you provided in step 9.
  10. Click OK
  11. For example:
    Using 4 vCPU
    Configuration you want
    Settings needed for this configuration
    Number of sockets
    Number of cores per socket
    Total cores
    Set vCPU to:
    Set cpuid.coresPerSocket/sockets to:
    1
    4
    4
    4
    4
    2
    2
    4
    4
    2










    Using 8 vCPU
    Configuration you want
    Settings needed for this configuration
    Number of sockets
    Number of cores per socket
    Total cores
    Set vCPU to:
    Set cpuid.coresPerSocket/sockets to:
    1
    8
    8
    8
    8
    2
    4
    8
    8
    4
    4
    2
    8
    8
    2
     
 

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


Friday 23 March 2012

How to Configure ILO Network Settings for Blade Servers in HP OA

In order to take the blade server in remote u need to configure ILO network configuration settings. Then by using that ip address u can reboot, shutdown, install operating systems

How to Configure ILO Network Settings for Blade Servers

Step1: In HP Onboard Administrator console, Front view of the server will be displayed in right hand side.  Using which note down the Device Bay number in which Blade servers were present

Step2: On the Left Panel find the "Enclosure Settings" tree menu

Step3: Expand the tree Enclosure Settings and click on "Enclosure Bay IP Addressing"

Step4: In the corresponding Bay Number enter the IP Address, Netmask, Gateway, Domain and DNS details.

Step5:  Once finish with entering the details select the checkbox on each Device Bay and click on Apply

Step6: Click on Device Bays and see whether the IP details are displaying.

How to Configure Management Settings in HP BladeSystem Onboard Administrator

Once new blade chasis has been set up. U need to configure management network to connect from remote place for installating Operating Systems and Managing Servers. Lets see

How to configure Management Network Setting for the Blade Enclosure

Step1: In the Left panel locate for "Enclosure Settings" menu
Step2: Expand the Tree "Enclosure Settings"
Step3: If u are going to assign the network details statically, then click on IPV4 link and enter the IP Address, Netmask, gateway, Primary and Secondary DNS.
Step4: Click on NIC Options link and select autonegotiate
Step5: Then click on Apply or Save button to save the network configuration Settings.

Monday 20 February 2012

How to kill cold vm migration process


I have cold migrated a virtual machine from one ESX host to another ESX host. Due to network connectivity the migration process was interrupted and cancelled. So to delete the copied files in destination ESX host i logged in to the Destination ESX host and tried deleting the copied files but i got

"Device or Resource is Busy"

Solution:

Restart the "vpxa" and "hostd" process
Then deleted the copied files.