Posts

Showing posts from July, 2015

VMware ESXi command line

Following are some useful commands I'm using in daily management of VMware ESXi 5.5 servers.

Showing the ESXi Gateway alternate to "netstat -rn" in Linux: # esxcfg-route -l


Alternate to "arp" command in Linux:# esxcli network ip neighbor list


List of all registered VMs: # vim-cmd vmsvc/getallvms


Restart the vpxa and ESXi host management agents:# /etc/init.d/hostd restart
# /etc/init.d/vpxa restart


Restart all the mgmt services in the ESXi host:# /sbin/services.sh restart


Restart VMware vCenter services: Remote desktop to Windows vCenter server, in the services, restart "VMware VirtualCenter Server". Same goes to restarting vCenter Inventory as well.

Alternate to "top" in Linux:# esxtop 


Check ESXi version and update level:#vmware -vl
   VMware ESXi 5.5.0 build-2068190
   VMware ESXi 5.5.0 Update 2


Listing the files that are opened and being used by VM: # vmkvsitools lsof | grep vm_name 

Current state of a virtual machine:# vim-cmd vmsvc/getallvm…

Add new Hard Disk to Linux LVM on VMware

If you decided to add or expand some space to your Linux server running on top of the VMware, here is how to do it by adding new hard disk to your VM.

VMware side:

1. In the vSphere client, right click on the desired VM and choose "Edit Settings"

2. In Hardware tab, click Add and choose "Hard Disk" and click next until new disk has been added to VM.


Within the Linux VM:

1. Detecting new hard disk

We need to check if Linux sees new hard disk:

# fdisk -l

Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000da861

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       26109   209202176   8e  Linux LVM

Disk /dev/mapper/vg00-lv_roo…