Hypervisor Cheatsheet

Operating systems that run other operating systems, lots of commands and reference material to keep track of.

Below is an ever growing list of things I found useful (and had to lookup more than once).

Installing VMware tools on RedHat/CentOS 7 
# yum install -y open-vm-tools
If they aren't enabled and/or aren't running
# systemctl enable vmtoolsd.service; systemctl start vmtoolsd.service

Increasing web session timeout in ESXi 6.x
Under Host, go to Manage, System, Advanced Settings, UserVars.HostClient.SessionTimeout
Change it to your desired setting from the default 900 seconds to as high as 7200 (a.k.a. 2 hours)

Adding ipmitool to ESXi (will likely need a later version of 6.x)
Download and unpack the ipmitool vib, then copy the it to the system under /tmp using scp, WinSCP, or your favorite transfer tool
Ssh to your ESXi system as root
Allow Community Supported vibs
[root@localhost:~] esxcli software acceptance set --level=CommunitySupported
Install the vib from there
[root@localhost:~] esxcli software vib install -v /tmp/ipmitool-1.8.11-2.x86_64.vib
(If it fails, add –no-sig-check)
It will be found in /opt/ipmitool/ipmitool and it can be run from there as below, or add it to your path
[root@localhost:~] /opt/ipmitool/ipmitool lan print

List disks
# xe sr-list

To remove a stuck SR 
# xe sr-list name-label="Local Storage1"
# xe pbd-list sr-uuid= 
# xe pbd-unplug uuid= 
# xe sr-forget uuid= 

Adding new hard disk to Xen 
# fdisk -l (to determine the path, i.e. /dev/sdb
# xe sr-create name-label=<Name of storage> shared=false device-config:device=<Path of storage> type=lvm content-type=user 
I.e. xe sr-create name-label=VMStore shared=false device-config:device=/dev/sdb type=lvm content-type=user 

Global unmounting of ISOs (hung VMs be caused by mounted ISOs) 
# xe vm-cd-eject --multiple 

Changing PV to HVM (which may stop the system from booting from ISO)
# xe vm-param-set uuid=(VM's UUID) HVM-boot-policy="BIOS order" HVM-boot-params-order=dc

Change booting kernel on VM that won't start
# xe-edit-bootloader -n "vm_name" -p 1 

Installation of Xen Tools on Linux (after right-clicking) 
# mount -o ro,exec /dev/disk/by-label/XCP-ng\\x20Tools /mnt 

If that doesn't work... 

# mount /dev/cdrom /mnt/ 

# /mnt/Linux/install.sh 

If it's an "unsupported" OS use one of these depending on OS (may need to alter version after -m )...
# /mnt/Linux/install.sh -d debian -m 9
# /mnt/Linux/install.sh -d rhel -m 7
# /mnt/Linux/install.sh -d sles -m 11
   Note: SUSE installs under chkconfig, so insserv will need to be installed in order to change it to on
      # zypper install insserv

Yes to reboot

Start Xen Console 
# xsconsole

Location of Guest Templates: /usr/share/xapi/vm-templates 

Should Guest Templates be missing 
# /usr/bin/create-guest-templates 

Location of VMs: /dev/VG_XenStorage.......

Location of Xen Tools: /opt/xensource/packages/iso 

Adding a local ISO SR 
# mkdir /var/opt/ISO_IMAGES 

Create and label the SR, it'll now be in the Xcp/Xen Mgr list 
# xe sr-create name-label=ISO_IMAGES_LOCAL type=iso device-config:location=/var/opt/ISO_IMAGES device-config:legacy_mode=true content-type=iso 

Copy ISOs to /var/opt/ISO_IMAGES via scp/sftp/wget (or your favorite transfer method) 

1 comment: