Hardware Management Console 101
Command-line actions improve backup procedures and more
Using Line Commands on the HMC
Occasionally it’s quicker to SSH into the HMC to execute commands. The HMC is actually a Linux system with a restricted command set. Common actions that may be performed at the command line include: opening and controlling vterms, listing dynamic IP addresses, getting details of an LPAR or system’s configuration, rebooting the HMC or an LPAR and powering a system on or off.
vterm Operations—One useful command to know is the vtmenu command—which provides a list of managed systems you can work with. You can then select the system and the LPAR to open the vterm to. To escape a terminal session selected in this way type in "~." Figure 1 shows an example of the vtmenu command.
Alternatively, the mkvterm command can be used to open a vterm to an LPAR. The command below will open a vterm to the LPAR that allows a user to then login once they receive the login prompt.
~> mkvterm -m p6-520-8203-E4A-06A8A94 -p p6vios1
Instead of -p p6vios1 you could use -id 3, where 3 is the LPAR ID. To exit the vterm you will need to type in "~~." or to use rmvterm.
rmvterm -m p6-520-8203-E4A-06A8A94 -p p6vios1
Rebooting the HMC—It’s possible to reboot the HMC using a line command. From the HMC login type in hmcshutdown -r -t now. This reboots the HMC immediately.
Controlling an LPAR via the HMC Command Line—If there are issues with the Web-browser interface it’s still possible to shutdown, activate or reboot an LPAR from the HMC command line. It’s also possible to power a managed server off or on. The following commands would shutdown and reboot the LPAR that is partition ID 3 (or that is named p6l1) on the managed system that is listed below. It’s an immediate shutdown as the command specifies -immed.
chsysstate -r lpar -m p6-520-8203-E4A-06A8A94 -o shutdown --immed --restart --id 3
chsysstate -r lpar -m p6-520-8203-E4A-06A8A94 -o shutdown --immed --restart -n p6lpar1
If an LPAR is already shutdown then it is possible to activate the LPAR as follows:
chsysstate -r lpar -m p6-520-8203-E4A-06A8A94 -r lpar -o on -n p6lpar1 -f default -b normal Above, the -f default would use the profile called default and the -b could be normal or sms, depending on whether this is a normal reboot or a boot into sms mode. It’s also possible to replace the -n p6lpar1 with the LPAR ID by using -id 3. Finally the whole machine can be powered on using the following:
chsysstate -m managedsystemname -o on -r sys
Commands to get Configuration Information—There are additional commands that will provide configuration information if it needs to be gathered in a hurry. The first of these will list the dynamic IP addresses served out by the HMC along with other network settings.
The lshmc -n command will list the hostname for the HMC, its domain information, the IP addresses for the public and private networks, the subnet mask, the gateway and nameserver plus additional network information, including the media access control (MAC) addresses of the network cards in the HMC.
The lssysconn command is used to list all of the known managed systems for the HMC along with certain attributes. Specifically, (see Figure 2) the serial number for the managed system, its connection status and the DHCP that it was assigned are all listed.
The lssyscfg command is used to get information about the attributes of managed systems. Typing in lssyscfg -r sys will cause all the attributes for all of the managed systems to be listed. The output can be limited to a specific system by using:
lssyscfg -r sys -name=p6-520-8203-E4A-06A8A94
System Plans—System plans are a critical component of systems documentation and can be invaluable if it’s necessary to recover a server. The lssysplan command can be used to provide a list of the current sysplans on the HMC.
name=mar2509-plan.sysplan,description=System plan created from p6-520-8203-E4A-06A8A94,source=HMC V7R220.127.116.11,version=HMC 1.5,"date=Mar 25, 2009 10:20:03 PM"
In order to create a system plan the command would be:
mksysplan -f p6520-jaqui.sysplan -m p6-520-8203-E4A-06A8A94
System plans can be taken from the GUI as well, but if there are problems with that method then the command-line version usually works. If you’re taking advantage of file-backed optical, then sometimes this causes problems for the system plan. Modifying the command to still probe the other LPARs but to not probe the virtual I/O servers will usually get around this. You can do this with the following command:
mksysplan -f p6520-jaqui.sysplan -m p6-520-8203-E4A-06A8A94 --novios
now shows: name=p6520-jaqui.sysplan,description=,source=HMC V7R18.104.22.168,version=HMC 1.5,"date=Jun 7, 2009 8:31:34 PM"
Other options on the mksysplan include -noprobe, --noinvscout and -nohwdisc. These are all explained clearly in the man pages for mksysplan on the HMC. Once the sysplan is created, it can then be viewed through the Web-browser interface or FTP’d to a desktop and viewed using the Systems Planning Tool. For more information on SPT, read “Using the Systems Planning Tool for Disaster Recovery.”
Understanding how to properly use the HMC is a critical part of the administrator’s role. Knowing how to use the command line and GUI to ensure smooth operation can make a huge difference in the capability to support the managed systems and its users. In all cases, the man command should be used beforehand to ensure the correct command syntax is being used. There are additional links in the references section that include general HMC information as well as the link to the command-line reference manual. Taking backups is a critical part of administering the HMC—these should be part of your regular backup cycle and should be sent off-site along with the LPAR backups, if that’s your company practice. Understanding the HMC command line can also save significant time and can be used to get around some of the issues that occasionally arise using the GUI interface.
comments powered by