ESXi

Command-line + ESXi Fun

I had some time to tinker after an upgrade of my system
Wanted to learn something new, and play I found some useful commands

The first useful command i could run is to list all registered guest on my host.

vim-cmd /vmsvc/getallvms

Get power state of a VM

vim-cmd /vmsvc/power.getstate <Vimid>

From the image above you see the power state of the vm named pms

… and here are a few more:

Unregister a VM
vim-cmd /vmsvc/unregister <Vmid>

Register a VM
vim-cmd /solo/register /path/to/file.vmx

Power off a VM
vim-cmd /vmsvc/power.off <Vmid>

Power on a VM
vim-cmd /vmsvc/power.on <Vmid>

 

ESXi 5.0 Update 1

  • Resolved / New: No error message is logged when VMkernel stops a virtual machine on a datastore that is in PDL state
    When a SCSI device goes into permanent device loss (PDL) state, all the virtual machines that use datastores backed by that SCSI device are affected. Some third party HA solutions incorporate a VMX option where disk.terminateVMOnPDLDefault is set to True. With this option the VMkernel stops such affected virtual machines. Starting with this release, when VMkernel stops affected virtual machines, a warning message similar to the following is logged in vmkernel.log once for each virtual machine.
  • NewEnablement of session timeout to ESXi Tech Support Mode (TSM)
    After you log in to an ESXi host at the console and then log in to the Tech Support Mode (Mode) as root user and initiate a remote server console access session, a non-privileged user might obtain root access to the ESXi host, if the remote access session has not timed out or remains idle.Starting with this release, you can configure a session timeout to exit ESXi Tech Support Mode (TSM) as follows:

    1. Log in to Tech Support Mode (Mode) as root user.
    2. Edit /etc/profile file to add TMOUT=<timeout value in seconds>.
    3. Exit Tech Support Mode (Mode).

Quick ESXi iSCSI configuration

Here is a quick walkthrough on connecting your ESXi host to an iSCSI target.
[Start Now]
Connecting to our ESXi server with the vSphere client is go into the configuration tab then storage adapters. Now we need to enable the iSCSI software adapter and click configure.
After enabling the software adapter we need to point it at our iSCSI target. Go to the dynamic discovery tab and “click add”.
Enter the IP address of the SAN and use port 3260
Click close and you will be prompted to rescan for storage, click yes
Our iSCSI disk will now show up under the software adapter
Go to the storage section of the configuration and click “Add Storage”
Select Disk/LUN and click “Next” then select the new iSCSI target and click “Next” and Click “Next” again
Enter a datastore name and click “Next”
Click “Next” unless you want to adjust the block size
Click “Finish”
Now your new iSCSI datastore is ready to use

Updating ESXi 5 – How To

So you are running ESXi5 standalone in my house or your office.  You have a need up patch this baby for the latest in driver support for guest and perhaps for Runing Windows 8 on vSphere 5

Here are a few things you might want to know and do to make this happen

 

Make sure you have ESXi Shell access on the ESXi 5 host.

Download the patch bundle directly from VMware Support. This download will be .zip file.  Do not extract it.

Upload the .zip file to a datastore that is accessible on the ESXi host you wish to update

Note:  In the examples below… Adjust accordingly.

Obtain local console access or ssh in.

Place your hose in maintenance mode and shutdown / pause all of your guest systems

To update the ESXi 5 host with the VIBs included in the depot, issue the following command:  esxcli software vib update --depot=/vmfs/volumes/datastore1/somepath/ESXi500-201109001.zip

When the update is complete reboot the ESXi 5 host

I could have also included other steps like verification of what is installed before and after, but why?  You should know how to do that and well there is always Google.

As always, thank you for reading this and I hope this helps.

Useful Link:  http://www.vmware.com/patchmgr/download.portal

 

Windows 8 on vSphere 5

So I have had this desire to run Windows 8 in VMware  vSphere 5 for a long time now.   Knowing I could run it in Workstation 8; I wanted to also run this on my ESXi 5 host, but could not… So I waiting waited for an update.  I wasn’t going to hack my way to what I wanted.  I did it the right , stable and supported way.

And well, here it is.

Importing Virtual Machine Templates: vCenter

Note:
In most cases, only system administrators can import virtual machines from vCenter

To import a virtual machine template from vCenter

In the left pane, select VM Templates.

Click Import VM Template.

Type a name.

(Optional) Type a description.

Select vCenter and select a virtual machine that is not managed by Lab Manager.

Click Next.

(Optional) Deselect the Perform customization check box if you do not want Lab Manager to customize the network settings for the virtual machine template or virtual machines based on the virtual machine template.

Specify the networking information for each NIC in the imported virtual machine template:

Select the Connected check box.
Choose a default virtual or physical network.
Choose a default IP addressing mode.

Select a storage lease.

Select a deployment lease.

Select the datastore to which you want to import the virtual machine template.

Select whether to copy or move the source virtual machine template.

If you copy the virtual machine template, it continues to exist in the original location, but if you move the virtual machine template, it will not exist in this location.

Click Import and then you wait…

Lab Manager imports the virtual machine template into the current organization and displays it on the VM Templates page.

vSphere – Creating User and Group Permissions

Create Privileges

  1. Click “View | Administration | Roles”
  2. Right client and cick “Add”
  3. Select a name and select the required privileges

Create User

  1. Click on the “Users and Groups” tab
  2. Click on the “Users” button
  3. Right click and select “Add”
  4. Specify the desired User Name, Password, etc and Click “OK”

Create a Local Group

  1. Click on the “Groups” button
  2. Right click and select “Add”
  3. Enter the group name you want and enter the User Name you created above in the User Name field and click Add
  4. Click “OK” to create the group

Assign Permissions

  1. Click on the “Permissions” Tab
  2. Right click and Select “Add Permission”
  3. Click on the “Add” button and select the Group you created above and click on the Add button.
  4. Click on the OK button.
  5. Choose the Assigned Role (Priviages) and click “OK”.

Note : You can use the permissions tab in either the main inventory (main page) or per Virtual Machine. This is useful to know if you need to allow one user to access just one Virtual Machine.

ESXi 4 – Tech Support Mode

Tech Support Mode (TSM) provides a command-line interface that can be used by the administrator to troubleshoot and correct abnormal conditions on VMware ESXi hosts. TSM can be accessed in two ways:
  • Logging in directly on the console of the ESXi server
  • Logging in remotely via SSH
Both of these methods can be disabled, and an optional timeout value can be configured to disallow local and remote TSM access after the specified timeout period.

Enabling and Accessing Tech Support Mode

To enable local or remote TSM from the Direct Console User Interface (DCUI):
  1. At the DCUI of the ESXi host, press F2 and provide credentials when prompted.
  2. Scroll to Troubleshooting Options, and press Enter.
  3. If you want to enable local TSM, select Local Tech Support and press Enter once. This allows users to login on the virtual console of the ESXi host.If you want to enable remote TSM, select Remote Tech Support (SSH) and press Enter once. This allows users to login via SSH on the virtual console of the ESXi host.
  4. Optionally, if you want to configure the timeout for TSM:
    1. Select Modify Tech Support timeout and press Enter.
    2. Enter the desired timeout value in minutes and press Enter.
  5. Press Esc three times to return to the main DCUI screen.
To enable local or remote TSM from the vSphere Client:
  1. Select the host and click the Configuration tab.
  2. Click Security profile > Properties.
  3. Click Local Tech Support or Remote Tech Support (SSH) and click Options.
  4. Choose the desired startup policy and click Start, then click OK.
  5. Verify that the daemon selected in step 3 shows as running in the Services Properties window.
To configure the TSM timeout value using the vSphere Client:
  1. Select the host and click the Configuration tab.
  2. Click Advanced Settings.
  3. Change the UserVars.TSMTimeOut field to the desired value in minutes.
  4. Click OK.
To access the local TSM:
  1. At the main DCUI screen, press ALT+F1 simultaneously. This opens a virtual console window to the host.
  2. Provide credentials when prompted.Note: When typing the password, characters are not displayed on the console.
To access the remote TSM:
  1. Open an SSH client.
  2. Specify the IP address or domain name of the ESX host.Notes:
    • Directions may vary depending on what SSH client you are using. For more information, consult vendor documentation and support.
    • By default, SSH works on TCP port 22.
  3. Provide credentials when prompted.

ESXi 4 on USB Thumb Drive

I have no doubts there are many people writing about this; so add me to the list.  I wanted to setup my small ESXi 4 Server to boot from USB media so that I no longer needed to have a local drive in the machine I use as a server.

Using VMware Player and a USB Stick, I was able to do this in a few simple steps.

[Step 1] Create a new 64bit virtual machine – this is very important as ESXi requires this.  Make sure that the virtual machine is configured with a USB controller.  I had also removed the virtual hard disk and other devices such as sound card, and printers, etc.

[Step 2] Mount the ESXi Install ISO and insert a USB Thumb Drive

[Step 3] Power on the virtual machine and make sure the USB Thumb Drive is made available

[Step4] Run thought the ESXi installer and select the USB drive as the installing disk – At this point we are just waiting for the installation to complete.

[Step 5] When completed, you will be asked to reboot the system.  At this point you can reboot and remove the USB Thumb Drive from the computer and plug it into your server.   Make sure your server is set to boot from the USB Thumb drive

When completed you will have ESXi running and you are good to go.  Enjoy!

PS3 Media Server – Remix

For several weeks now I have been running PS3 Media Server (http://code.google.com/p/ps3mediaserver/) hosted on Ubuntu 10 Desktop (http://www.ubuntu.com/), when I decided to fine tune my environment by making the system headless as I had no need to interact with a desktop environment.

Info:

PS3 Media Server is a DLNA compliant UPNP Media Server which can stream movies to a large majority of DLNA clients such as the PS3.   It’s written in Java, with the purpose of streaming or transcoding all kinds of media files, with minimum configuration needs.  The PS3 Media Server also runs on Windows Platforms running the latest versions of Java.

Ubuntu is a … let’s stop here, if you don’t know what Ubuntu is then perhaps you should stop reading now.

Mini How-To:

Starting off with a fresh clean install of Ubuntu Server (Linux flavor of choice) I step though the installation choosing to only install the OpenSSH Server.  Once logged into the system I issue a quick sudo passwd to change the root password and activate root account. For the remainder of the install process I will use ssh to work in the CLI (command line interface) of my server install.

Step 1:   Install Base OS of Ubuntu 10 Server

Install base Ubuntu Server OS, enabling SSH access, changed root password activating it.

Step 2: Install the prerequisites on the server along with updates to get that out of the way

While in the local terminal or via ssh run the following command(s) (if your logged in via root, no need for sudo)

~# apt-get install mplayer mencoder ffmpeg

~# apt-get install openjdk-6-jre-headless

~# apt-get install vlc vlc-nox

Step 3: Download Install and unpack PMS (PlayStation media server)

Now I download the latest Linux release of PMS from http://code.google.com/p/ps3mediaserver/downloads/list and extract it.

~# cd /home/<your directory of choice> *note if you are root, you can place this where ever you wish*

~# wget http://ps3mediaserver.googlecode.com/files/pms-linux-1.10.5.tgz

~# tar xzf pms-linux-1.10.5.tgz *this will extract the packaged*

Step 4: Move the PMS to a new folder location. I choose the /opt/ folder, you can also choose your own, and it’s entirely up to you.

~# mkdir /opt *if this does not exists on your system.  It should in Ubuntu by default

~# mv ~/pms-linux-x.xx.x/ /opt/pms

~# cd /opt/pms

~# chmod +x PMS.sh

~# chmod +x linux/tsmuxer

Step 5: Now we create and modify the base PMS configuration file

This file hold general options used by PMS, you can change the configuration as mine are tailored for how I run PMS, these options are subject to change.  *note it’s a good idea to tweak your settings for the optimal performance

~# nano PMS.conf

If the file does not exist you will have a blank page to work in.
The following are the options in my configuration file:

thumbnails = false

mencoder_ass = true

hidevideosettings = true

hide_extensions = true

hide_enginenames = true

audiochannels = 2

folders = /media/video

Step 6: Testing that PMS is working correctly.

~# ./opt/pms/PMS.sh

When this is run you will see test output from the application staring up and logging of status events.

Step 7: PMS start-up script

~# cd /etc/init.d

~# nano startpms *this will create a new file to start the server*

Inside the file contains the following information:

#!/bin/bash

cd /opt/pms

nohup ./PMS.sh &

exit

Save the file and make it executable by typing: chmod +x startpms

This can all be added to the system startup configuration; however I have no done this yet.

And now you have a running DLNA / UPNP Media Server running on a Linux box.

System Specifications:

Ubuntu 10.04.1 LTS – 2.6.32-24-generic-pae
512 MB RAM
Intel 2 GHz P4

8GB (no need for this much space as media is remotely hosted on network storage). Media is hosted on remote systems and mounted to the Linux installation which uses local directory paths.

This system is hosted in a virtual machine guest under VMware ESXi, 4.0.0, 261974

By |How-To, Software, Technical|Comments Off on PS3 Media Server – Remix