Section 13.3. Configuring and Managing ESX Server Service Console from the Command Line


13.3. Configuring and Managing ESX Server Service Console from the Command Line

The previous section of this chapter focused on some of the more common commands used to navigate the directory structure, to manage files and directories and manage users and groups. This section covers commands which are most applicable for managing your processes, devices, and the configuration of your ESX Server from the Service Console. The command line can be used to manage your ESX server VMFS volumes, device allocations, network configuration, running processes, and virtual machines. This section discusses the following:

  • Managing processes and viewing performance statistics

  • Managing physical and virtual disks

  • Installing and managing software packages

  • Managing devices and changing hardware and network settings

13.3.1. Managing Processes, Restarting Services, and Viewing Performance Statistics

From time to time you may find it necessary to view running processes for troubleshooting purposes. You may also need to kill a running process that is not running correctly. The following sections show the command-line tools you can use to manage processes, restart services, and view the performance data of your Service Console.

13.3.1.1. Managing Processes

You can use the ps and kill commands to view your running processes.

To list all processes running on the Service Console, type

psef

Each process will be listed with its process ID (PID). If you want to list all processes shown with its parent process, type

psefH

Figure 13.27 shows a partial output of the command. Notice the PPID, which is circled. This is the process ID of the parent controlling process.

Figure 13-27. Partial Output of ps Command


If you need to kill a process, type

kill pid

You would replace pid with the process ID of the process you wish to stop. If you need to force a process to stop if kill will not work, type

kill -9 pid

If you have a program that is actively running in the foreground, you can suspend the program by pressing Ctrl + z. You can also place the program in the background and let it continue to run by typing

bg

To start a command running in the background, type

command&

To list all programs running in the background, type

jobs

And to stop a background job, type

kill %jobnumber
13.3.1.2. Restarting Services

If you need to change the way services start on your Service Console, or you need to restart services when configuration changes have been made, you can use the following commands:

If you need to restart a service, type

service service-name restart

A good example would be restarting the Web server by typing

service httpd.vmware restart

To have a service start at boot time, type

chkconfig service-name on

Note: You can find the name of available services in the /etc/init.d directory by typing ls/etc/init.d.
13.3.1.3. Viewing Service Console Performance Statistics

To get a real-time view of your Service Console's performance statistics, type

top

The results for top are shown in Figure 13.28

Figure 13-28. Real-Time View of a Service Console's Performance Statistics


To exit the top utility, press Quit. The top utility displays top CPU processes by default, but you can specify additional options. You can specify specific processes you would like to monitor, kill processes, and rearrange the way results are shown on screen.

If you want more details on the capabilities of top, you can view the man page for it by typing

man top

13.3.2. Managing Physical and Virtual Disks

This section shows the commands used to manage both the physical disk of your ESX Server and the virtual disk files.

If you need to view current partitions, sizes, and the amount of disk space consumed, type

vdfh

The output of the vdfh command is shown in Figure 13.29

Figure 13-29. Output of the vdfh Command


If you want to view the contents of a VMFS volume on your server, type

vmkfstoolsl vmfs_label

Or you can specify the hba number, scsi target, LUN number, and partition numbersay, for example, by typing

vmkfstoolsl vmhba0:0:11

Figure 13.30 shows the output of the vmkfstoolsl vmhba0:011 command. The easiest way to find the vmhba information is to look back at Figure 13.29, which shows the output of the vdfh command. This shows you the configured vmfs volumes on your server. You can also use the lsl command to view the contents of your vmfs volume.

Figure 13-30. Using the lsl Command to View the Contents of a vmfs File


To identify the source of a vmdk file, type

head virtual_disk.vmkd | file

Table 13.4 shows the outputs depending on which VMware product was used to create the virtual disk.

Table 13-4. Outputs of head virtual_disk.vmkd | fileCommand

VMware Product

Command Output

ESX Server virtual disk file

X86 boot sector

Workstation 4/5 or GSX Server 3 virtual disk file

ASCII English text

Workstation 3 or GSX Server 2 virtual disk file

(no response)


To check disk space consumption under a specific directory, type

dusk directory-name

To find out which device file maps to a LUN, type

vmkpcidivyrefreshnames

(This refreshes the table of device files.) Then type

vmkpcidivyq vmhba_devs

To export a virtual disk from vmfs to a different location on your ESX Server, type

vmkfstoolse /targetdirectory/filename.vmdk /vmfs/volume_label/sourcefile.vmdk

One of the main reasons you would want to do this is to move a virtual machine template from the vmfs volume to a directory that contains your template images on your server.

If you need to import a virtual disk file from VMware Workstation of GSX Server, type

vmkfstoolsi source_directory_name /vmfs/volume_label/targetfile.vmdk

If the virtual disk is already in ESX Server format, you can use the cp or mv commands to move the file from a template directory to the VMFS volume or vise versa.

13.3.3. Installing and Managing Software Packages

While maintaining your ESX Server you may find it necessary to install or remove additional software packages on the Service Console. Examples of this are third-party management agents, backup software, and so on. The Service Console uses Red Hat Package Manager (RPM packages) for software tracking and installation. RPM maintains a database of installed packages and tracks which files are required for software to function properly.

If you want to find out which packages are currently installed on your server, type

rpmqa

Remember, you can also use the command with grep to filter for specific packages. For example, we queried the RPM database for all packages that contain VM in the package name. You can see the results of this query in Figure 13.31

Figure 13-31. Output of the rpmqa | grep vm Command


To view the packages in sorted order, type

rpmqa | sort | more

To view the description of a package, type

rpmqi name_of_package

An example of this can be seen in the following command:

rpmqi VMware-ccagent-esx-2.5.0-11343

The results are shown in Figure 13.32

Figure 13-32. Output of rpmqi Displaying Detailed RPM Package Information


To find out which files are associated with a software package, type

rpmql name_of_package

To uninstall a package on your server, type

rpmUvh /path_to_RPM_Package/name_of_package

13.3.4. Managing Devices and Changing Hardware and Network Settings

You may want to know which device drivers are currently loaded by the Service Console for troubleshooting purposes. The following shows a few ways to find out.

To view the device drivers currently loaded by the Service Console, type

lsmod

To view the device drivers currently loaded by the VMkernel, type

vmkload_mod --list

To view or change the device allocation between the Service Console and the VMkernel, type

vmkpcidivy -i

This command allows you to change the following options on your ESX Server:

  • The amount of memory allocated to the Service Console

  • Enable hyperthreading

  • Setup for your disk controller

  • Setup for your NIC cards

You'll have the option to commit or discard your changes at the end of the configuration questions.

To view the IP address of the Service Console, type

ifconfig eth0

To change the IP address or subnet mask of the Service Console NIC, edit the following file:

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

Change the IPADDR=xx.xx.xx.xx line to the new IP address or change the NETMASK=xx.xx.xx.xx line to the new subnet mask.

To change the default gateway, edit the following file:

/etc/sysconfig/network

Then, edit the following line:

GATEWAY=gateway-ip

Note: If you used the netconfig utility to configure networking on your server, you may actually find the gateway address in the /etc/sysconfig/network-scripts/ifcfg-eth0 file.

To change the DNS Server settings on the Service Console, edit the following file:

/etc/resolv.conf

Then, edit the following lines:

  • search dns-suffix

  • nameserver primaryDNS-ip

  • nameserver secondaryDNS-ip

If you need to change the host name of the ESX Server, edit the following files:

/etc/sysconfig/network

Change the HOSTNAME=servername line to reflect the new hostname /etc/hosts (if an entry for your server does not exist, then add one in the following format):

IP-address FQDN alias

The following can be used as an example:

Table 13-5.

10.10.10.5

esxhost1.virtual.net

esxhost1


Once you've made the changes to the configuration files, you need to restart networking for the changes to take effect.

To restart networking, type

service network restart

To prepare your Service Console to synchronize time across the network, you need to set up the ntpd daemon by performing the following steps:

Set the ntpd service to start at boot time by typing

chkconfig ntdp on

Then you need to create the /etc/ntpd.conf file. Within the /etc/ntdp.conf file place the IP address or DNS name of your NTP server, preceded by the work server.

An example of this would look like the following:

Table 13-6.

server

timeserver.virutal.net


Once you've completed this step, you need to start the ntpd daemon by typing

service ntpd start



Virtualization With VMware ESX Server
Configuring VMware ESX Server 2.5 (Vol 1)
ISBN: 1597490199
EAN: 2147483647
Year: 2005
Pages: 173

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net