Sunday, July 09, 2006

Changing ESX Hostname and IP

My company had some new techs that came in once and built three ESX servers at three sites. Though we informed them of our naming conventions, one site had a server named improperly and another site was setup in a lab rather than the DC.

So we were faced with re-configuring the IP on one ESX server, and changing the hostname on another. I thought it would be good for some of the newbies to know how to do this.

Change ESX Hostname

To change the host name of a machine running ESX Server, modify the following files:

/etc/hosts/
etc/sysconfig/network/
usr/lib/vmware-mui/apache/conf/httpd.conf

Then you will have to restart the ESX Server or the appache service itself, and the network service.

Change ESX IP Host

The IP-address is stored in;

/etc/sysconfig/network-scripts/ifcfg-eth0

If your network changed and you have a new default getway, you also need to change this file:

/etc/sysconfig/network

After editing the files you can activate the changes by restarting the network with this command:

/etc/init.d/network restart

CD Change Fails on Disk 2...

This one was submitted by a colleague of mine;

Topic: CD Change Fails on Disk 2 During Installation of Red Hat Linux 9.0, Red Hat Enterprise Linux 2.1 or Red Hat Enterprise Linux 3

Question: I am trying to install Red Hat Linux 9.0, 2.1 or Red Hat Enterprise Linux 2.1 or Red Hat Enterprise Linux 3 as a guest operating system on a Windows host system. After I insert the second installation CD, I get an error message saying a package cannot be opened. The message says the CD media may be corrupt, but I know I have a good CD.

Answer: The Red Hat installer may fail to read the second installation CD correctly if the CD drive in your virtual machine is set up using the defaults.

The specific failure message depends on the set of packages you choose to install. In many cases, the first package the installer tries to read from the second CD is the XPDF package, so the error message reports a problem with xpdf-[version number].

You can force the installer to read the second CD correctly by taking the following steps:

1. When the installer asks for the second CD, remove the first CD from the drive and leave the drive empty.

2. Tell the installer to continue. It closes the CD drive tray, then gives an error message when it finds no CD.

3. Insert the second CD and tell the installer to continue. It should read the second CD correctly and installation should continue with no problems.

Note: If the virtual machine was created with GSX Server 3, as an alternate workaround, you can configure the virtual machine's virtual CD-ROM drive to run in legacy emulation mode. To change this setting, power off the virtual machine, choose VM > Settings > CD-ROM, and select the Legacy emulation check box. Click OK to save your change.

Set time on ESX Server

This would be like issuing a net time /setsntp:w.x.y.z on a windows box

On the ESX server issue the following;

hwclock --set --date="mm/dd/yy hh:mm:ss"

Example

hwclock --set --date ="12/06/05 10:04:00"

How to determine WWN on ESX Server

I've written a decent article on this topic which is very helpful. I haven't added the ESX section to my website yet, but if you would like a copy drop me an e-mail.

If you know how many HBAs exists, and what type (I.e. Emulex – lpfc) then you could execute the following command after logging in to the CLI.

cat /proc/scsi/lpfc/0

or

cat /proc/scsi/lpfc/1

Error:vmware-authd: 511 Error connecting to...

Okay, this one can sometimes be nasty. In this scenario something is hosing up either the MUI or HTTPD. I'm still trying to conquer this one, but the following procedure has been known to work in the past for me;

To resolve the problem, open the CLI as root or account that has permission to restart DAEMONS.

Then execute the following;

1) Restart the xinetd: /etc/init.d/xinetd restart
2) Restart the mui: /etc/init.d/httpd.vmware restart

Retry, and you should be able to connect to the MUI

I have also found this thread to be useful at times.

ESX\LINUX Equivalent of IPCONFIG

Typically you guys won't need this. But I actually needed to know what the IP Address was on a ESX server the other day, while logged into the console.

So, here ya go;

ifconfig Will display all the goodies for each network interface

dhclient -r Will release the IP or;

dhclient Will renew the IP.

I believe you can use something like; dhclient eth0 -r To specify which interface to renew, etc.

For more info, type man dhclient

Scanning devices for new LUNS

When ESX is booted, it scans fiber and SCSI devices for new and existing LUNs.

You can manually initiate a scan through the console by running the following shell command;

cos-rescan.sh

This is actually the VMWare preferred method.

Enlarging the size of a VM

Okay, so let's assume you created a 30GB drive for your VM. After a while, you quickly realize that's not going to be enough. So how do you increase it without having to create a new one and move the data over? Easy, vmkfstools is a very power tool.

To increase the size of the vmdk, open a SSH to the ESX server. Navigate to where you store your VMDK files.

Issue the following command;

vmkfstools -X xyG ServerName.vmdk

Example to increase XYZSERVER.vmdk from 10GB to 30GB

vmkfstools -X 30G XYZSERVER.vmdk

Saturday, July 08, 2006

Installing VMKUSAGE

Okay, if you've been using ESX for long or have been to the class you'll know all about vmkusage. However, for those of you who don't you should. Where I work, most of the guys fail to install this as they setup ESX and place into production as they've grown dependant on Virtual Center capturing performance data.

So, vmkusage is just that usage analysis reports on your ESX server as well as the VMs running on it. It's very useful in keeping track of how well your ESX server is performing. I'll blog a article later on how to read the reports, but for now let's worry about installing it so it can start collecting data. (Ususally you'll have something to look at within 5 minutes)

Installing vmkusage

To install, simply open a SSH connection using
putty to the ESX server and logon as root.
Next, type the following at the command line;

vmkusagectl install

Let the cron collect for at least 5 minutes before trying to view stats. To access the stats go to;

http://ESXSERVER/vmkusage

Thursday, March 16, 2006

How to copy a VM from 1 ESX Server to another

I wanted to put this out there as this is a common question I'm asked.

How to copy VM from 1 ESX Server to another.

1. Use Putty to open an SSH connection to the ESX server you want to copy the VM to. (Destination)

2. Login and navigate to the VMFS partition you want the VM placed. (I.e. cd /VMFS/MyVMFS)

NOTE: This is important, if you miss this step you will fill up your home directory..

3. Next, issue the following command;

sftp -C root@SOURCEESXIP:/PATH/VMFILE.dsk

Sample

sftp -C
root@10.20.1.140:/vmfs/MyVMFS/W2K3TEMPLATE.dsk

4. Enter the password for the source ESX server.

5. Follow the prompts, wait for the copy to complete and you're done.