VMware

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.

How-To: install VMware .bundle on Ubuntu

By now many I have come accustom to installing programs using the apt-get method in Ubuntu, but there comes a time where we need to remember those other commands to install things.  For example when attempting to install software packaged in .bundle file format.

It all started when I downloaded VMware player and went to install the .bundle.  I wasn’t sure at that time what to do with it.  A Google search later I had my answer; and I hope Google got you to this page where I also share with you how-to do this.

In Ubuntu you open your command line terminal and type the following:

sudo sh VMware- ‘press tab to auto complete’

That’s it…   Follow the instructions and you are finished.

Purging old data from the database used by VirtualCenter 2.x (a repost)

VirtualCenter stores tasks, event, and performance data in the VirtualCenter database. Over time, data collection results in growth of the database files and a mechanism is needed to shrink these files.

VirtualCenter 2.x does not have a feature to purge or shrink old records from the database. For more information on shrinking databases after running the scripts provided in this article, see:

Link 1: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1000125

Link 2: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1025914

 

How to Shrink a Database (http://msdn.microsoft.com/en-us/library/ms189035.aspx) & (http://msdn.microsoft.com/en-us/library/ms189080.aspx)

 

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!

VIM_VCDB database ‘PRIMARY’ filegroup is full (part 2)

After cleaning up your Virtual Center Database to get us back and running I came across the following

vCenter Server 4.x has a Database Retention Policy setting that allows you to specify when vCenter Server tasks and events should be deleted. Since this setting does not affect performance data records it is still possible to purge or shrink old records from the database using the scripts attached to this article. To access the Database Retention Policy setting in the vSphere Client, click Administration > vCenter Server Settings > Database Retention Policy.

By |How-To, Software, Technical|Comments Off on VIM_VCDB database ‘PRIMARY’ filegroup is full (part 2)

VIM_VCDB database ‘PRIMARY’ filegroup is full

Additional Errors:  CREATE DATABASE or ALTER DATABASE failed because the resulting cumulative database size would exceed your licensed limit of 4096 MB per database.

Cause:  The 4 GB limit is a limit of SQL Server Express 2005.   If you needed to grow your database beyond that size, you would want to upgrade to SQL Server 2005 Workgroup / Standard or Enterprise.  If you want to continue using SQL Express, then you’ll need to purge data from the database

 

Why does this happen, and how to prevent it

Virtual Center stores tasks, event, and performance data in the Virtual Center database. Over time, this data needs to be removed.  There are two variations of this solution, one for each of the supported vCenter database platform.

How to fix

– Make a full database backup

– Stop all Virtual Center Server services

Run the following script below on the Virtual Center Database

/*

VCDB_table_cleanup_MSSQL_V4.X.sql,v 4.0 2010/08/12

 

This script will delete data from designated tables in the VirtualCenter DB

for vc4.x versions.

 

You are strongly advised to shut down the VirtualCenter server and make

a complete backup of your database before running this script.

 

VirtualCenter Server must be stopped while this script is running.

 

Please see USER CONFIGURABLE PARAMETERS section below for options.

 

In particular, you must set @DELETE_DATA = 1 in order to actually delete rows;

this is a safety precaution.

 

Directions: open this file with one of the following and execute:

SQL Query Analyzer (SQL Server 2000) or

SQL Server Management Studio (SQL Server 2005)

SQL Server Management Studio (SQL Server 2008)

 

Connect using the same DB login that VirtualCenter uses.

 

The transaction log may fill up during this procedure if sufficient space

is not available.  Monitor the transaction log size and usage with this command:

 

dbcc sqlperf (logspace)

 

*/

 

 

IF OBJECT_ID(‘tempdb..#CLEANUP_VCDB’) IS NOT NULL

DROP TABLE #CLEANUP_VCDB

GO

 

SET NOCOUNT ON

 

DECLARE @VCUSER NVARCHAR(60)

DECLARE @VCUSERID INT

DECLARE @BATCH_SIZE INT

DECLARE @CUTOFF_DATE SMALLDATETIME

DECLARE @CUTOFF_DATE_S NVARCHAR(60)

DECLARE @DELETE_DATA BIT

DECLARE @CNT INT

DECLARE @TOT INT

DECLARE @SQL NVARCHAR(900)

DECLARE @FROM_VAL NVARCHAR(60)

DECLARE @WHERE_VAL NVARCHAR(900)

 

 

— ######### USER CONFIGURABLE PARAMETERS ########################

— 0 = COUNT ONLY; 1 = DELETE ROWS

SET @DELETE_DATA = 0

 

— Use one of these methods to specifiy the data cutoff date

SET @CUTOFF_DATE = GETUTCDATE()-180

–SET @CUTOFF_DATE = ‘2007/01/01’

 

— Number of rows to delete per transaction

SET @BATCH_SIZE = 10000

 

— ######### END USER CONFIGURABLE PARAMETERS ####################

 

— PERFORM SOME ERROR CHECKING TO ENSURE DB ACCESS

SELECT @VCUSERID = UID FROM SYSOBJECTS

WHERE NAME = ‘VPX_VERSION’

 

IF @@ROWCOUNT < 1

BEGIN

PRINT ‘The ‘ + DB_NAME() + ‘ database does not appear to contain VirtualCenter tables.’

PRINT ‘Please ensure you are connected to the correct database.’

RETURN — stop execution of this script

END

 

SELECT @VCUSER = NAME FROM SYSUSERS

WHERE UID = @VCUSERID

 

PRINT ‘VirtualCenter database user: ‘ + @VCUSER

PRINT ‘Logged in user: ‘ + CURRENT_USER

 

IF (@VCUSER <> CURRENT_USER) AND (@VCUSER <> ‘dbo’)

BEGIN

PRINT ‘***************************************************************’

PRINT ‘You do not appear to be logged in as the VirtualCenter DB user.’

PRINT ‘Please log in as ”’ + @VCUSER + ”’ to execute this SQL script.’

PRINT ‘***************************************************************’

RETURN

END

 

— DONE WITH ERROR CHECKING

 

— CONVERT THIS DATE TO A STRING WITH QUOTES FOR EFFICIENCY LATER

SET @CUTOFF_DATE_S = ”” + CONVERT(NVARCHAR, @CUTOFF_DATE, 111) + ””

PRINT ‘Cutoff date: ‘ + @CUTOFF_DATE_S

 

PRINT ‘Batch size: ‘ + CONVERT(NVARCHAR, @BATCH_SIZE)

 

PRINT CONVERT(NVARCHAR, getdate(), 120) + ‘ starting…’

 

CREATE TABLE #CLEANUP_VCDB (VPXTABLE NVARCHAR(40), CRITERIA NVARCHAR(250), INITIAL_CNT INT, DELETE_CNT INT)

 

IF ((SELECT VER_ID FROM VPX_VERSION)< 4)

BEGIN

INSERT #CLEANUP_VCDB VALUES (‘VPX_HIST_STAT’, ‘SAMPLE_ID IN (SELECT ID FROM VPX_SAMPLE WHERE SAMPLE_TIME < ‘ + @CUTOFF_DATE_S + ‘)’, 0, 0 )

INSERT #CLEANUP_VCDB VALUES (‘VPX_SAMPLE’, ‘SAMPLE_TIME < ‘ + @CUTOFF_DATE_S, 0, 0 )

END

ELSE

BEGIN

INSERT #CLEANUP_VCDB VALUES (‘VPX_HIST_STAT1’, ‘TIME_ID IN (SELECT TIME_ID FROM VPX_SAMPLE_TIME1 WHERE SAMPLE_TIME < ‘ + @CUTOFF_DATE_S + ‘)’, 0, 0 )

INSERT #CLEANUP_VCDB VALUES (‘VPX_SAMPLE_TIME1’, ‘SAMPLE_TIME < ‘ + @CUTOFF_DATE_S, 0, 0 )

INSERT #CLEANUP_VCDB VALUES (‘VPX_HIST_STAT2’, ‘TIME_ID IN (SELECT TIME_ID FROM VPX_SAMPLE_TIME2 WHERE SAMPLE_TIME < ‘ + @CUTOFF_DATE_S + ‘)’, 0, 0 )

INSERT #CLEANUP_VCDB VALUES (‘VPX_SAMPLE_TIME2’, ‘SAMPLE_TIME < ‘ + @CUTOFF_DATE_S, 0, 0 )

INSERT #CLEANUP_VCDB VALUES (‘VPX_HIST_STAT3’, ‘TIME_ID IN (SELECT TIME_ID FROM VPX_SAMPLE_TIME3 WHERE SAMPLE_TIME < ‘ + @CUTOFF_DATE_S + ‘)’, 0, 0 )

INSERT #CLEANUP_VCDB VALUES (‘VPX_SAMPLE_TIME3’, ‘SAMPLE_TIME < ‘ + @CUTOFF_DATE_S, 0, 0 )

INSERT #CLEANUP_VCDB VALUES (‘VPX_HIST_STAT4’, ‘TIME_ID IN (SELECT TIME_ID FROM VPX_SAMPLE_TIME4 WHERE SAMPLE_TIME < ‘ + @CUTOFF_DATE_S + ‘)’, 0, 0 )

INSERT #CLEANUP_VCDB VALUES (‘VPX_SAMPLE_TIME4’, ‘SAMPLE_TIME < ‘ + @CUTOFF_DATE_S, 0, 0 )

END

 

DECLARE curse CURSOR FOR

SELECT VPXTABLE, CRITERIA FROM #CLEANUP_VCDB

 

OPEN curse

FETCH NEXT FROM curse INTO @FROM_VAL, @WHERE_VAL

 

WHILE (@@FETCH_STATUS = 0)

BEGIN

SET @SQL = ‘SELECT @CNT= COUNT(1) FROM ‘ + @FROM_VAL + ‘ WHERE ‘ + @WHERE_VAL

— this is required to get result into a variable

EXEC sp_executesql @SQL, N’@CNT INT OUTPUT’, @CNT = @CNT OUTPUT

 

SET @SQL = ‘UPDATE #CLEANUP_VCDB SET INITIAL_CNT = ‘ + CONVERT(NVARCHAR, @CNT) + ‘ WHERE CURRENT OF curse ‘

EXEC(@SQL)

 

IF (@CNT = 0)

BEGIN

PRINT CONVERT(NVARCHAR, getdate(), 120) + ‘ ‘ + @FROM_VAL + ‘: no matching rows to delete.’

FETCH NEXT FROM curse INTO @FROM_VAL, @WHERE_VAL

CONTINUE

END

 

PRINT CONVERT(NVARCHAR, getdate(), 120) + ‘ ‘ + @FROM_VAL + ‘: will attempt to delete ‘ + CONVERT(NVARCHAR, @CNT) + ‘ rows.’

 

IF @DELETE_DATA = 1

BEGIN

SET @CNT = 0

SET @TOT = 0

 

SET ROWCOUNT @BATCH_SIZE

 

WHILE 1=1

BEGIN

BEGIN TRAN

SET @SQL = ‘DELETE FROM ‘ + @FROM_VAL + ‘ WHERE ‘ + @WHERE_VAL

EXEC(@SQL)

 

SET @CNT = @@ROWCOUNT

SET @TOT = @TOT + @CNT

 

COMMIT TRAN

 

IF @CNT < @BATCH_SIZE BREAK

PRINT CONVERT(NVARCHAR, getdate(), 120) + ‘ completed ‘ + CONVERT(nvarchar, @TOT) + ‘ rows…’

END –ROW BATCH LOOP

 

SET ROWCOUNT 0

PRINT CONVERT(NVARCHAR, getdate(), 120) + ‘ ‘ + @FROM_VAL + ‘: deleted ‘ + CONVERT(nvarchar, @TOT) + ‘ total rows.’

 

SET @SQL = ‘UPDATE #CLEANUP_VCDB SET DELETE_CNT = ‘ + CONVERT(NVARCHAR, @TOT) + ‘ WHERE CURRENT OF curse ‘

EXEC(@SQL)

 

END — DELETE DATA SECTION

ELSE

BEGIN

PRINT CONVERT(NVARCHAR, getdate(), 120) + ‘ This is a test run, no data was deleted.’

END

 

FETCH NEXT FROM curse INTO @FROM_VAL, @WHERE_VAL

END — END CURSOR LOOP

 

CLOSE curse

DEALLOCATE curse

 

IF @DELETE_DATA = 1

BEGIN

PRINT ‘ ‘

PRINT ‘****************** SUMMARY *******************’

 

DECLARE curse CURSOR FOR

SELECT VPXTABLE, INITIAL_CNT, DELETE_CNT FROM #CLEANUP_VCDB

 

DECLARE @INITIAL_VAL INT, @DELETE_VAL INT

 

OPEN curse

FETCH NEXT FROM curse INTO @FROM_VAL, @INITIAL_VAL, @DELETE_VAL

 

WHILE (@@FETCH_STATUS = 0)

BEGIN

IF (@INITIAL_VAL <> @DELETE_VAL)

BEGIN

PRINT ‘Potential problem: attempted to delete ‘ + CONVERT(NVARCHAR, @INITIAL_VAL)

+ ‘ rows, but only ‘ + CONVERT(NVARCHAR, @DELETE_VAL) + ‘ deleted.’

END

ELSE

BEGIN

PRINT ‘Deleted ‘ + CONVERT(NVARCHAR, @DELETE_VAL)

+ ‘ rows from ‘ + CONVERT(NVARCHAR, @FROM_VAL) + ‘ table.’

END

 

FETCH NEXT FROM curse INTO @FROM_VAL, @INITIAL_VAL, @DELETE_VAL

END

 

CLOSE curse

DEALLOCATE curse

 

END –DELETE DATA CHECK

 

DROP TABLE #CLEANUP_VCDB

By |How-To, Technical|Comments Off on VIM_VCDB database ‘PRIMARY’ filegroup is full

Raw Hard Disk (dd) Images As VMDK Virtual Disks

Written in Java and is designed to be OS independent. raw2vmdk creates an appropriately structured VMDK file that refers to the raw image, which can then be mounted by VMware.

It is extremely simple to use and provides the required results in seconds. This is a new tool, so if you have any feedback please do leave it in the comments below or contact the author directly.

You can download raw2vmdk here:  raw2vmdk-0.1.1.tar.gz

Full Project URL:  http://sourceforge.net/projects/raw2vmdk/files/

By |News, Software|Comments Off on Raw Hard Disk (dd) Images As VMDK Virtual Disks

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

HowTo: VMware Tools in Ubuntu 10

Again I am working on my server; a virtual machine powered by VMware.  I recalled that I did not have the tools installed; also the virtual server console gave me an additional reminder.  So I decided to install.

There are a few things to do before installing.  First we need to make sure our server (Ubuntu) has compiler tools installed.  Then we must mount the virtual cd containing the VMware drivers and software tools for Linux.  From the command line terminal (I recommend doing this from the local console) as the network tools will drop you from the SSH connection.

Steps

sudo aptitude install build-essential linux-headers-$(uname -r)
cp -a /media/cdrom/VMwareTools* /tmp/
cd /tmp/
tar -vxzf VMwareTools*.gz
cd vmware-tools-distrib/
sudo ./vmware-install.pl

You will be asked a bunch of questions; I personal just accept the defaults and (press ENTER) to each one of them.  When completed, I reboot my server and that is it.  Tools are installed.

By |How-To, Technical|Comments Off on HowTo: VMware Tools in Ubuntu 10