Showing posts with label ESXi. Show all posts
Showing posts with label ESXi. Show all posts

Wednesday, July 5, 2023

How to unlock the ESXi root account from the console

Press CTRL+ALT+F1 to launch the ESXi Shell

At the ESXi shell login with root and the password

Run the following commands to show number of failed attempts:

pam_tally2 --user root

Run the following command to unlock the root account:

pam_tally2 --user root --reset

Monday, December 13, 2021

How to change ESXi host root password using CLI

Log in to the ESXi/ESX host service console, either via SSH or the physical console. 
Note: If you did not log in as root, you must acquire root privileges by running the command: 

 su - 

Enter the current root password when prompted. 

Change the root password by executing: 

 passwd root  

Enter the new root password, and press Enter. Enter the password a second time to verify. You are warned about, but not prevented from using, bad passwords.

Monday, July 26, 2021

 


ESX host appears to have lost connection to a data sore by when you try to manually mount it you get an error displayed above.

The solution is to unmount the data store using CLI and then mount it again manually using the GUI. Here is the command to unmount the data store.

esxcli storage nfs remove -v <VolumeName>

Saturday, March 20, 2021

Test VMkernel network connectivity with the vmkping command

Connect to the ESXi host using an SSH session and run this command:

vmkping -I vmkX x.x.x.x

Where x.x.x.x is the hostname or IP address of the server that you want to ping and vmkX is the vmkernel interface to ping out of.

If you have Jumbo Frames configured in your environment, run the vmkping command with the -s and -d options.

vmkping -d -s 8972 x.x.x.x

Note: In the command, the -d option sets DF (Don't Fragment) bit on the IPv4 packet. 8972 is the size needed for 9000 MTU in ESXi.
To test 1500 MTU, run the command:

vmkping -I vmkX x.x.x.x -d -s 1472

Verification of your MTU size can be obtained from a SSH session by running this command:

esxcfg-nics -l

Output should be similar to:

esxcfg-nics -lName PCI Driver Link Speed Duplex MAC Address MTU Description
vmnic0 0000:02:00.00 e1000 Up 1000Mbps Full xx:xx:xx:xx:xx:xx 9000 Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
vmnic1 0000:02:01.00 e1000 Up 1000Mbps Full xx:xx:xx:xx:xx:xx 9000 Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)


esxcfg-vmknic -l

Output should be similar to:

esxcfg-vmknic -l
Interface Port Group/DVPort IP Family IP Address Netmask Broadcast MAC Address MTU TSO MSS Enabled Type
vmk1 iSCSI IPv4 10.10.10.10 255.255.255.0 10.10.10.255 XX:XX:XX:XX:XX:XX 9000 65535 true STATIC

Thursday, May 30, 2019

How does vCenter communicate with ESXi server

Access to the ESXi host is provided by a vCenter agent named vpxa. The vpxa process is started on the ESXi host when it is added to the vCenter Server inventory. Vpxa communicates with the ESXi host agent named hostd. The hostd process runs on the ESXi host and it is used to manage most of the operations on the host. Most command some from vCenter Server through hostd (e.g. virtual machine creation, migration, removal. etc.).

Vpxa acts as an intermediary between the vpxd process on vCenter Server and the hostd process to relay the tasks to be performed on the host.

When you are logged in to vCenter through vSphere Web Client, vCenter passes commands to the ESXi host through the vpxa process. If you are using the vSphere Client to communicate directly with the ESXi host, the communication goes directly to the hostd process.

Monday, June 27, 2016

How to install Dell OMSA on an ESXi host

  1. Download the appropriate version of OMSA from Dell's website
  2. Upload the ZIP (VIB) file to the ESXi host to /var/tmp
  3. Run following command to install VIB

    esxcli software vib install -d /var/tmp/OM-SrvAdmin-Dell-Web-8.3.0-1908.VIB-ESX60i_A00.zip
  4. Reboot the host

Tuesday, December 1, 2015

Run this PowerCLI script to map the .naa disk name to the datastore name on an ESXi host

Connect-VIServer -Server "server_name" -User "user_name" -Password "password"
Get-Datastore |
Where-Object {$_.ExtensionData.Info.GetType().Name -eq "VmfsDatastoreInfo"} |
ForEach-Object {
  if ($_)
  {
    $Datastore = $_
    $Datastore.ExtensionData.Info.Vmfs.Extent |
    Select-Object -Property @{Name="Name";Expression={$Datastore.Name}},
      DiskName
  }
}

Thursday, May 28, 2015

How to list VIBs installed on an ESXi host

Below is the command for listing VIBs installed on an ESXi server

esxcli --server=server_name software vib list --rebooting-image

Connect to the sever console and run the following:

esxcli software vib list


Thursday, February 19, 2015

How to disable warning for ESXi Shell and SSH in the vSphere client


To disable this warning through the vSphere Client do the following:

  1. Select the ESXi host from the Inventory.
  2. Click the Configuration tab.
  3. Click Advanced Settings in the Software menu.
  4. Navigate to UserVars > UserVars.SuppressShellWarning.
  5. Set the value from 0 to 1.
  6. Click OK.

Wednesday, February 11, 2015

Using the ESXi 5.x esxcli command to power off a virtual machine

The esxcli command can be used locally or remotely to power off a virtual machine running on ESXi 5.x. For more information, see the esxcli vm Commands section of the vSphere Command-Line Interface Reference.

Open a console session where the esxcli tool is available, either in the ESXi Shell, the vSphere Management Assistant (vMA), or the location where the vSphere Command-Line Interface (vCLI) is installed.

Get a list of running virtual machines, identified by World ID, UUID, Display Name, and path to the .vmx configuration file, using this command:

esxcli vm process list

Power off one of the virtual machines from the list using this command:

esxcli vm process kill --type=[soft,hard,force] --world-id=WorldNumber

Notes: 
Three power-off methods are available. Soft is the most graceful, hard performs an immediate shutdown, and force should be used as a last resort.
Alternate power off command syntax is:

esxcli vm process kill -t [soft,hard,force] -w WorldNumber

Repeat Step 2 and validate that the virtual machine is no longer running.

Thursday, October 16, 2014

How to remove ESXi core dump files

I've noticed recently that one of my data stores started to fill up despite the fact that there are no VMs on it -- used for VM templates. After a quick investigation I realized that all my ESXi hosts started to save core dump files in that data store. This appears to be a new "feature" in ESXi 5.5.

Here is a bit of an explanation I pulled from the VMware forums:
As it got mentioned earlier, the coredump partition of older ESX(i) hosts is only 110 MB large, and we have seen coredumps that are larger than that size when collected through netdump, or we have seen incomplete coredumps in case of deployments where only the 110 MB coredump partition was available. With the introduction of ESXi 5.1 we enabled an option to use larger coredump partitions through the boot option "diskDumpSlotSize", however the default partition size still remained at 110 MB, which means a customer needs to reconfigure the host manually. See KB 2012362 [1] for details.
To avoid the manual reconfiguration step, we introduced with ESXi 5.5 the coredump file feature. It allows ESXi to determine whether the current host might try to generate a coredump that won't fit into the coredump partition. If such a condition has been identified, ESXi will automatically create the file /vmfs/volumes/<some datastore>/vmkdump/<HW-UUID>.dumpfile with the appropriate size.
This means just the presence of the *.dumpfile is no indication of a problem with ESXi, it just indicates that the host is prepared for the case of crash of ESXi and should enable VMware support to retrieve a complete coredump. In case of a crash of ESXi, ESXi will extract the coredump out of the configured dump file and create a vmkernel-zdump* file in /var/core during the first reboot following the crash.
For new ESXi 5.5 deployments the coredump partition got increased to 2.5 GB, so that for most fresh deployments a coredump file wouldn't be required.

In order to delete those files one needs to connect to each of the ESXi hosts through the console and run the following command:

esxcli system coredump file list

The command will produce a result similar to this:



Here you can see that there are two dump files. The on listed as active (true) is the one that was generated by the host with an active console connection. In order to remove that file one needs to execute the following command:

esxcli system coredump file remove -F

The files will get recreated next time the ESXi server is rebooted. In order to disable auto-generation of those files one would need to set "autoCreateDumpFile" boot option to FALSE.

Sunday, March 9, 2014

No CPU and memory usage data from host available in vCenter

Sometimes the cpu and memory usage of individual ESXi 5.x hosts will not be available in the vCenter. In order to correct this you will need to restart the management agents on the ESXi server(s).

There are two ways to restart the agents:

1. From the Direct Console User Interface (DCUI):

Connect to the console of your ESXi host.
Press F2 to customize the system.
Log in as root.
Use the Up/Down arrows to navigate to Restart Management Agents.

Note: In ESXi 4.1 and ESXi 5.0, 5.1 and 5.5, this option is available under Troubleshooting Options.

Press Enter.
Press F11 to restart the services.
When the service has been restarted, press Enter.
Press Esc to log out of the system.


2. From the Local Console or SSH:

Log in to SSH or Local console as root.
Run these commands:

/etc/init.d/hostd restart
/etc/init.d/vpxa restart

3. To restart all management agents on the host from the SSH console:

servcies.sh restart

Tuesday, February 4, 2014

How to check and set time on an ESXi 5.x host


To check the time and to make sure you server is synchronizing do the following:
  1. Connect to the host using SSH
  2. Run this command to check time and date:

    date
  3. Run the following command to check time synchronization:

    watch ntpq localhost
  4. Output should be something like this:

    remote refid st t when poll reach delay offset jitter
    ==============================================================================
    *10.11.12.130.0.0.0 1 - 46 64 377 43.76 -5.58 40000

To set the time through the command line run the following from the console:

# esxcli system time set -d 31 -M 1 
-y 2012 -H 18 -m 0 -s 0

Tuesday, January 7, 2014

How-to enable SSH login message banner in ESXi 5.x

  1. Login to your ESXi 5.x server via SSH as root.
  2. Create a backup of the original file by: cp /etc/issue /etc/issue.bak
  3. Use vi editor to open the issue config file: vi /etc/issue
  4. Enter your message and save and quit VI editor
  5. Restart the SSH daemon by: /etc/init.d/SSH restart

Monday, January 6, 2014

How to bring Realtek 8168/8169 network adapters back to life under vSphere 5.5

As with all previous vSphere releases, vSphere 5.5 dropped support for certain network adapters. One of those is Realtek 8168/69. Luckily the drivers included in vSphere 5.1 will work in 5.5. You can either extract the drivers form the distributable ESXi install (ZIP) or download the VIB from the links provided below. Once you have the driver files follow steps outlined below.

  1. Upload the VIB to a datastore which is visible by your ESXi 5.5 host (volume1 in this example)
  2. Make sure that you enable SSH and connect via Putty
  3. Use the following command to install the VIB: esxcli software vib install -v /vmfs/volumes/volume1/VMware_bootbank_net-r8169_6.011.00-2vmw.510.0.0.799733.vib
  4. Reboot host

To check installed VIBs run the following command: esxcli software vib list

Here is the source of the information:

http://www.vladan.fr/realtek-8169-nics-not-detected-under-esxi-5-5/

http://www.bussink.ch/img/VMware_bootbank_net-r8168_8.013.00-3vmw.510.0.0.799733.vib
http://www.bussink.ch/img/VMware_bootbank_net-r8169_6.011.00-2vmw.510.0.0.799733.vib

Sunday, January 5, 2014

Enable SNMP traps on ESXi 5

--Following commands are for vSphere CLI -- NOT Power CLI--

specify community string/name
vicfg-snmp.pl --server esxi-1 --username root --password 123456 -c CommunityName

specify target
vicfg-snmp.pl --server esxi-1 --username root --password 123456 -t 10.10.10.1@161/CommunityName

enable
vicfg-snmp.pl --server esxi-1 --username root --password 123456 --enable

test
vicfg-snmp.pl --server esxi-1 --username root --password 123456 --test

Friday, December 6, 2013

How to enable copy/paste inside VI client for all VMs on an ESXi host

  1. Log in to the ESX/ESXi host as a root user.
  2. Take a backup of the /etc/vmware/config file.
  3. Open the /etc/vmware/config file using a text editor.
  4. Add these entries to the file:

    isolation.tools.copy.disable="FALSE"
    isolation.tools.paste.disable="FALSE"

  5. Save and close the file.

Monday, November 18, 2013

Restart management services on an ESXi 5.x host

Run the following from the console:

/etc/init.d/hostd restart
/etc/init.d/vpxa restart

You can also run this:


services.sh restart

Friday, September 20, 2013

vSphere networking using console commands

To list network adapters run this:

esxcfg-nics -l

Output will be something like this:

Name    PCI           Driver      Link Speed     Duplex MAC Address       MTU    Description
vmnic0  0000:01:00.00 igb         Down 0Mbps     Half   bc:30:5b:ee:b3:c8 1500   Intel Corporation I350 Gigabit Network Connection
vmnic1  0000:01:00.01 igb         Down 0Mbps     Half   bc:30:5b:ee:b3:c9 1500   Intel Corporation I350 Gigabit Network Connection
vmnic2  0000:01:00.02 igb         Down 0Mbps     Half   bc:30:5b:ee:b3:ca 1500   Intel Corporation I350 Gigabit Network Connection
vmnic3  0000:01:00.03 igb         Down 0Mbps     Half   bc:30:5b:ee:b3:cb 1500   Intel Corporation I350 Gigabit Network Connection

To view driver and firmware versions for a particular NIC run this:

ethtool -i vmnic4

Output will be similar to this:

driver: ixgbe
version: 3.14.3iov
firmware-version: 0x8000042f
bus-info: 0000:03:00.0

Friday, September 13, 2013

vSphere 5 - list LUNs, UUIDs and NAA names

Run this command to list LUNs and their corresponding UUIDs and NAAs

esxcli storage vmfs extent list