Friday, March 20, 2009

HMC Tips I - HMC and Managed System

To enable ssh in a hmc :

# chhmc -c ssh -s enable
You can disable it by replacing the word 'enable' with 'disable'

To enable xntp in a hmc :

# chhmc -c xntp -s enable
You can disable it by replacing the word 'enable' with 'disable'

To add an entry in the syslog config file :

# chhmc -c syslog -s add -a IP_Addr ( or '-h host_name' )
You can remove an entry by replacing the word 'add' with 'remove'

To add an entry in the ntp config file :

# chhmc -c xntp -s add -a IP_Addr ( or 'h host_name' )
You can remove an entry by replacing the word 'add' with 'remove'

To configure the network as a startup device :

# chhmc -c netboot -s enable
You can disable it by replacing the word 'enable' with 'disable'

To permit IP addresses from utilizing HMC services :

# chhmc -s ssh ( or any_service) -s add -a IP_Addr
You can remove an entry by replacing the word 'add' with 'remove'

To add a DNC_server or domain_suffix :

# chhmc -c network -s add [-ns DNS_Server] [-ds domain_suffix ]
You can remove an entry by replacing the word 'add' with 'remove'

To change network settings for a specific network interface :

# chhmc -c network -s modify -i interface_name
[-a IP_Addr] [-nm network_mask] [ --lparcomm on|off]
Note: Network settings for the s10 interface cannot be changed.

To change other network settings :

# chhmc -c network -s modify
[-h hostname] [-d network-domain-name]
[-g gateway]

To change the locale for the HMC :

# chhmc -c locale -s modify -l locale

To change the HMC date and time, time zone :

# chhmc -c date -s modify
[ --datetime ]
[ --clock {local | utc} ]
[ --timezone {time-zone | none} ]

To list the BIOS Level of the HMC :


# lshmc -b
To list the current locale :

# lshmc -l

To list all of the locales supported by HMC :

# lshmc -L

To list network settings :

# lshmc -n

To list remote access settings :

# lshmc -r

To list VPD information :


# lshmc -v

To list version information :


# lshmc -V

To display IP connections to SP's and Bulk Power Controllers :

# lssysconn -r all

To list all machines configured in a hmc

# lssyscfg -r sys

To power on a managed system :

# chsysstate -r sys -m managed_system-o on -f SYS_PROF_NAME

To power on a managed system in standby mode :

# chsysstate -r sys -m managed_system -o onstandby -f sys_profile_name

To power off a managed system :

# chsysstate -r sys -m managed_system -o off --immed

To restart a managed system :

# chsysstate -r sys -m managed_system -o off --immed --restart

To recover partition data for a managed system :


# chsysstate -r sys -m managed_system -o recover

To initiate service processor failover for a managed system :


# chsysstate -r sys -m managed_system -o spfailover

To validate or activate a system profile :


# chsysstate -r sysprof -m managed_system -n sys_profile_name --test

To change the password of a managed system :


# chsyspwd -t {access | admin | general} -m managed_system --passwd current_password --newpassword new_password

Saturday, March 7, 2009

AIX - Tips and Tricks - Part IV

AIX Tips 'n' Tricks - Part IV

1. How to list IDE controllers in your system ?

lscfg -l ide*

Sample Output:

DEVICE LOCATION DESCRIPTION
ide0 01-00-00 ATA/IDE Controller Device
ide1 01-00-01 ATA/IDE Controller Device

It shows
Controller ide0 and ide1 are located on the system planar
(Notice 1st and 2nd digits in location code).
The planar indicator is the second digit in the location value with a value of 1.
6th digit indicates the controller number.

2. After a successful login, the login command displays the message of the day, the date and time of the last successful and unsuccessful login attempts for this user, and the total number of unsuccessful login attempts for this user since the last change of authentication information (usually a password).

How to supress these messages?

You can supress these messages by creating a .hushlogin file in your home directory.

At the prompt in your home directory, type the following:
# touch .hushlogin

The touch command creates the empty file named .hushlogin if it does not already exist. The next time you log in, all login messages will be suppressed. You can instruct the system to retain only the message of the day, while suppressing other login messages.

3. What are the files, system reads when you logon ?

First File : /etc/environment - contains variables specifying the basic environment for all processes.

Second File: /etc/profile - controls system-wide default variables

Third File : $HOME/.profile - lets you customize your individual working environment

Fourth File: $HOME/.env - lets you customize your individual working environment variables.


4. How to override variables defined in /etc/environment for a particular user?

A fourth file that the operating system uses at every user logon is the
$HOME/.env file, if your .profile contains the following line: export
ENV=$HOME/.env The .env file lets you customize your individual
working environment variables.

The .env file contains the individual user environment variables that override the variables set in the /etc/environment file. You can customize your environment variables as desired by modifying your .env file.

5. How to change the font in AIX ?

To change the font to an italic, roman, and bold face of the same size, type the following:

# chfont -n /usr/lpp/fonts/It114.snf /usr/lpp/fonts/Bld14.snf /usr/lpp/
fonts/Rom14.snf

You can also use smitty chfont.

6. How to run a process in the background ?

For Ex, to run script1.sh in background run

# script1.sh & -> But this script process gets killed if you close the terminal

So always run, # nohup script1.sh &

Usage of nohup doesn't kill the process if you close the telnet session.
Output from the process/script will be stored in a file called nohup.out in the directory from where you started the process.

So if you want to start backup using mksysb and close your terminal wihle leaving leaving office, you can safely use "nohup command &".

Next day morning, you can view the contents of nohup.out to know the status of the backup job.

7. Whats the default priority for a process?

Default priority is 0. Priority numbers is in the range of -20 to 20.
Highest number is the lowest priority and lowest number has hight priority.

To set the priority while start a process, use nice command.
If the process is already running, you can use "renice" command to change its priority.

8. How to stop, resume a process and to make it foreground process?

To stop(pause) a foreground process, use Cntrol + Z keys ie., Ctrl+Z.

Note: Ctrl+Z works in the Korn shell (ksh) and C shell (csh), but not in the Bourne shell (bsh). To restart a stopped process, you must either be the user who started the process or have root user authority.

To restart a stopped process, enter
# kill -19 pid

To run it in foreground, enter
# fg pid

where pid is the procedd id which can be obtained from "ps -ef | grep process_name"

9. How to display a program output as well as copying to a file ?

Normally usage of output redirection supresses the output on screen.
Ex. ls -l > file1

If we want to redirect the output as well as show the output in screen use the tee command.

Ex: ls -l | tee -a file1

10. How to capture the terminal screen to a file ?

To capture the screen of a terminal, at the prompt, type the following:

#script

The system displays information similar to the following:

Script command is started. The file is typescript.

Everything displayed on the screen is now copied to the "typescript" file.

To stop the script command, press Ctrl-D or type exit and press Enter.

The system displays information similar to the following:

^D
Script command is complete. The file is typescript.

Use the cat command to display the contents of your file.

11. How to number all lines in a file ?

# n1 -ba file1.txt

This will display all lines of file1.txt alongwith their line number.

12. What are the supported file systems in AIX ?

a) JFS (or) JFS2 - Disk based file system
b) NFS - Network based File system
c) CDRFS - CDROM based file system
d) UDFS - DVD-ROM based file system
e) RAMFS - RAM based file system used while booting the system

13. What are the different directory abbreviations ?

Abbreviation Meaning
. The current working directory
.. The parent of the current working directory
~ Your home directory
$HOME Your home directory

14. What are the different directory path names ?

Absolute path name - Traces the path from the /(root) directory.
Absolute path names always begin with the slash (/) symbol.
Ex. /home/raja/dir1

Relative path name - Traces the path from the current directory
through its parent or its subdirectories and files. As user "raja", I
can say ./dir1 since I'm already in /home/raja

15. How to move a directory ?

# mvdir book manual

This moves the book directory under the directory named manual, if the manual directory exists. Otherwise, the book directory is renamed to manual.

16. What the RAID groups AIX LVM supports?

RAID-0 - Striping
RAID-1 - Mirroring
RAID-10 (or) RAID 0+1 - Mirroring and striping

17. How to read and remove mails from my system mailbox?

At your system command line prompt, enter the mail command:
# mail

If there is no mail in your system mailbox, the system responds with a message:
No mail for YourID

If there is mail in your mailbox, the system displays a listing of the messages in your system mailbox:

Mail Type ? for help.
"/usr/mail/lance": 3 messages 3 new
>N 1 karen Tue Apr 27 16:10 12/321 "Dept Meeting"
N 2 lois Tue Apr 27 16:50 10/350 "System News"
N 3 tom Tue Apr 27 17:00 11/356 "Tools Available"

The current message is always prefixed with a greater-than symbol (>).

Each one-line entry displays the following fields:

status - Indicates the class of the message.
number - Identifies the piece of mail to the mail program.
sender - Identifies the address of the person who sent the mail.
date - Specifies the date the message was received.
size - Defines the number of lines and characters contained in the message (this includes the header).
subject- Identifies the subject of the message, if it has one.

The status can be any of the following:
N - A new message.
P - A message that will be preserved in your system mailbox.
U - An unread message. This is a message that was listed in the mailbox the last time you used the mail program, but the contents were not examined.
* - A message that was saved or written to a file or folder.

18. What is the difference between IBM system p5 570 and IBM System p570 Server models ?

IBM System p5 570 is the P5(Power5 Processor) server whereas System p
570 is the latest model from IBM containing POWER 6 Processor.

19. How to display the values of NFS tuning parameters?

# nfso -o

20. How to monitor the performance of file systems?

Use filemon command.

21. How to list the available memory slots (DIMM) in your pSeries box ?

# lscfg -vp | grep -e "Memory DIMM" -e "Size"

22. What are the login programs what do not need AIX license ?

ftp, rsh and recec.

23. Have you seen some people use rmt0.1 (or) rmt1.5 for tape device name. We know rmt0 or rmt5 is a tape drive name but whats the ".1" or ".5" that comes after the tape drive name.

Here is the logic

rmt0.x where x = A + B + C

A = density 0 = high 4 = low
B = retension 0 = no 2 = yes
C = rewind 0 = yes 1 = no

So rmt0.1 means tape drive rmt0 with no rewind.
Normally if we use rmt0 for taking backup, after the backup operaation
tape gets rewinded. IF you dont want to rewind, use rmt0.1

24. Tips on System Dump Device

a) Don't mirror the system dump device
b) Don't use compression on the dump device
c) Don't use a secondary dump device unless it is on a seperate device

25. How to monitor/obtain LVM performance?

Use lvmstat command.

26. How to monitor/obtain NFS performance statistics?

Use nfsstat command.

27. How to set the variables defined in a file to the current shell/ environment ?

Suppose you the following variable defined in file1.sh

LANG=jp_JP
TZ=CUT-5

To set them in current shell, run ". ./file1.sh"

28. How will you encode a binary file ?

uuencode command converts a binary file to ascii data. This is mainly used for sending a file thru mail.

For Ex.,
uuencode source_file output_file

29. How you decode a file (which was encoded using uuencode command) ?

# uudecode source_file

30. How to view a a compressed file without uncompressing it ?

Use "zcat file1.Z"

31. How to configure the system to send mails each time an error is added to error report

a. Create a file /tmp/mailtoroot

errnotify:
en_name = "mailtoroot"
en_persistenceflg = 1
en_method = "/usr/bin/errpt -a -l $1 | mail -s \"errpt: $9\" root"

b. odmadd /tmp/mailtoroot

c. Verify by creating a error message

# errlogger 'Test Error Message"

You can always remove this ODM entry using the below command:

# odmdelete -q 'en_name=mailtoroot' -o errnotify

Tuesday, February 10, 2009

AIX - Tips and Tricks - Part III

1. To list machines configured in a NIM Server,
# lsnim -c machines

2. To list networks configured in a NIM Server,
# lsnim -c networks

3. To reset a machine (return to ready state)
# nim -Fo reset MachineName

4. To list core file settings for a user,
# lscore user1

The output will look like:
compression: on
path specification: default
corefile location: default
naming specification: off

5. To list the default settings for the system,

# lscore -d

The output will look like:
compression: off
path specification: on
corefile location: /corefiles
naming specification: off

6. To make any process run by root dump compressed core files and restore the location of the core files to the system default,

# chcore -c on -p default root
Note: If no default is specified, cores will dump in the current directory.

7. To enable a default core path for the system, type:

# chcore -p on -l /corefiles -d

8. To scan logical volume lv01, report the status of each partition, and have every block of each partition read to determine whether it is capableof performing I/O operations, type:

# mirscan -l lv01

9. To do the above operation in a PV,

# mirscan -p hdisk1

10. To do the above operation in a VG,

# mirscan -v vg01

11. To determine if the 64-bit kernel extension is loaded,

# genkex grep 64

12. To list all JFS file systems,

# lsjfs

13. To list all JFS2 file systems

# lsjfs2

14. To mirror a terminal1 on terminal2
a. Open terminal 1 and find the pts value (ps -ef grep pts)

b. Open terminal 2 and enter 'portmir -t pts/1'
c. Now you will see commands and outputs from terminal 1 in terminal 2.
This is basically monitor a terminal.
d. Say "portmir -o" to end the mirroring after the use

15. To identify the current run level,

# cat /etc/.init.state

16. To list the available CD ROM drives,

# lsdev -Cc cdrom

17. To find out the speed of your network adapter,

# entstat -d ent0 grep "Media Speed"

18. To find out when your system was last installed/updated

# lslpp -f bos.rte

19. To list the status of your tape drive,

# tctl -f /dev/rmt0 status

20. How to setup anonymous ftp in AIX

Run the below script to setup anon ftp,
# /usr/lpp/tcpip/samples/anon.ftp

21. If telnet takes more time to produce a prompt, do the below checks

a. do nslookup of the client ip from the aix serverb.
b. Check the nameservers in /etc/resolv.confc.
c. Check the 'hosts' entry in /etc/netsvc.conf or NSORDER variable

This issue might be due to the DNS configuration issue. Pointing to a good nameserver should solve the problem.

22. How to shutdown the system to maintenance mode ?

# shutdown -Fm

23. How to log ftp accesses to a file

a. Add the below line in /etc/syslog.confdaemon.debug /tmp/daemon.log
b. # touch /tmp/daemon.log
c. # refresh syslogd
d. Modify your inetd.conf so that ftpd is called with the "-l" flag.

24. How to find a file name from inode number ?

# ncheck -i xxxx /mountpoint
where xxxx -> inode number of the file

25. How to redirect the system console to a file or tty temporarily

# swcons /tmp/console.out

or

# swcons /dev/tty5

26. How to recreate a deleted /dev/null file ?

# /bin/mknod /dev/null c 2 2

27. How to add commands that should get executed during every system shutdown ?

Add them to /etc/rc.shutdown

28. How to reduce the size or do cleanup of /var/adm/wtmp ?

# > /var/adm/wtmp

29. How to find out the fileset a file belongs to ?

# which_fileset command_name

30. In which file, the mapping of file Vs fileset stored ?

# /usr/lpp/bos/AIX_file_list

31. How to set maximum logins for a user in a system ?

Change the value of "maxlogins" under "usw" stanza in /etc/security/login.cfg

32. How to change the initial message that prints while logging in ?

Change the value of "herald" in /etc/security/login.cfg

33. How to set the # of seconds the user is given to enter their password ?

Change the value of "logintimeout" under "usw" stanza in /etc/security/login.cfg

Links to my old tips

Tips and Tricks - Part I
Tips and Tricks - Part II