Sunday, November 4, 2007

Virtual I/O Server - Some Commands

Initialize the LPAR Configuration :

# mkgencfg -o init

[OS] Software Management :

To display VIO Server level:

# ioslevel

To update the IOS software:

# updateios –dev /update -

To installs a new filesets (mainly used for TL updates):

# updateios –dev /cd0 -install -accept

To commit all applied :

# updateios –commit

To rejects all uncommitted updates :

# updateios –reject

To clean all incomplete pieces of the previous installation :

# updateios –clean

To remove a fileset :

# updateios –remove fileset_name

To take the OS backup in a CD ROM :

# backupios –cd /dev/cd1 -cdformat

To take the OS backup in a DVD-RAM :

# backupios –cd /dev/cd1 -udf

To take the OS backup in a tape drive :

# backupios –tape /dev/rmt0

Just verifies the backup available in a tape :

# backupios –tape /dev/rmt0 -verify

Generates backup to a file. No user VGs are -nosvg back’d up :

# backupios –file /opt/file1

To display the underlying AIX OS version :

# oem_platform_level

To open a non-restricted root shell :

# oem_setup_env

This shell is used mainly for the installation of vendor software such as device drivers.

Remote Management :

To enable remote_management using NIM master :

# remote_management nim1

To disable remote management :

# remote_management –disable

License Management:

To display the current license :

# license –view

To accept the license :

# license –accept

To view if the license has been accepted :

# license

Software Management:

To list all the installed software :

# lssw

To list all the installed software and their history

# lssw –hist

Management of Virtual Terminals:

To open a virtual terminal for partition with id 2 :

# mkvt –id

To close a virtual terminal for a partition with id 2 :

# rmvt –id 2

Device Management:

To change the attribute of a device permanently.

# chdev -dev scsi0 -attr id=6 -perm

Sometimes it reboots the system if perm is used

To disable the path between hdisk1 and scsi0 :

# chpath -dev hdisk1 -pdev scsi0 -op disable

To configures the devices in the VIO server :

# cfgdev

To configures the devices attached to scsi0 adapter :

# cfgdev –dev

To unconfigure the cd-rom device :

# rmdev –dev cd0

To unconfigure scsi adapter and its child devices :

# rmdev –recursive –dev scsi1

To unconfigures the children of pci1 but not the PCI bus pci1 :

# rmdev –pdev pci1

Management of Virtual/Shared Devices:

To create a virtual target device that maps lv20 as a virtual disk for a client partition hosted by the vhost0 virtual server adapter :

# mkvdev -vdev lv20 -vadapter vhost0

Same as above except here hdisk is used instead of a logical volume :

# mkvdev -vdev hdisk6 -vadapter vhost2

To create a SEA that maps the physical Ethernet adapter ent4 as a virtual adapter for the client

partitions served by the virtual Ethernet adapters ent6 and ent7, using ent6 as the default adapter and 8 as the default id :

# mkvdev -sea ent4 -vadapter ent6,ent7 -default ent6 -defaultid 8

To remove a virtual target device vtscsi9 along with its backing lv :

# rmvdev –vdev vtscsi9 –

To remove all virtual target device associated with backing device lv001 :

# rmvdev –vdev lv001

To remove a specific virtual target device :

# rmvdev –vtd vtscsi10

List Device Mapping:

To list all virtual target devices and backing devices mapped to virtual server adapter vhost2 :

# lsmap -vadapter vhost2

To list SEA and physical device mapped to virtual Ethernet Adapter ent4 :

# lsmap -vadapter ent4 –net

To list all virtual target devices and backing devices where backing devices are of type LV :

# lsmap -all -type lv

To list all network mapping :

# lsmap –all –net

How to list Devices :

To display all the devices :

# lsdev

To display all the virtual devices :

# lsdev –virtual

To display all the virtual adapters :

# lsdev –type adapter –virtual

To display all the slots :

# lsdev –slot s

To display all the adapters :

# lsdev –type adapter

Few other device types: disk, lv, optical, tape, tty

To list all physical Ethernet adapters and Etherchannel available for creating a SEA :

# lsdev –type ent4sea

To list all virtual Ethernet adapters available for creating a SEA :

# lsdev –type ven4sea

To list all adapters over which ip address can be configured :

# lsdev –type ent4ip

To display parent device of a device :

# lsdev –dev hdisk0 –

To list disks names and physical location alone :

# lsdev -type disk -field name physloc

Logical Volume Manager :

Volume Group

To create a vg on hdisk1 :

# mkvg -vg newvg hdisk1

To drain I/O's for a vg and suspends future I/O's :

# chvg -suspend vg03

To resume normal I/O operations for a vg :

# chvg -resume vg03

Unlock a VG if left in a locked state by abnormal termination of another lvm operation :

# chvg -unlock vg03

To add a physical volume to a volume group :

# extendvg vg3 hdisk3

To remove a PV from a VG :

# reducevg vg01 hdisk1

To remove a PV and all residing LVs from a VG with no confirmation :

# reducevg –rmlv –f vg01

To activate a vg :

# activatevg vg03

To deactivate a vg :

# deactivatevg vg03

To mirror the VIO Server’s rootvg to hdisk4 and reboots VIO Server :

# mirrorios –force hdisk4

To mirror the VIO Server’s rootvg to hdisk4 but don’t reboot the server :

# mirrorios –defer hdisk4

To remove the rootvg mirror from hdisk4 :

# unmirrorios hdisk4

To import a VG from hdisk07 :

# importvg –vg vg001 hdisk07

To export a VG :

# exportvg vg3

Note: Volume Group containing a paging space can’t be exported

To sync a VG :

# syncvg –vg vg01

To sync a LV :

# syncvg –lv lv001

To sync a PV :

# syncvg –pv hdisk4 hdisk5

To redefine a VG based on the VGDA from hdisk04 :

# redefvg –dev hdisk04

Logical Volume :

To create a logical volume of size 1MB in vg01 :

# mklv –lv lv001 vg01 1M hdisk1

To create a logical volume with mirror in place in vg01 of size 1GB :

# mklv –mirror vg01 1G

To extend an LV by 3MB :

# extendlv lv01 3M

To extend an LV by 1GB with space taken from hdisk5 :

# extendlv lv01 1G hdisk5

To remove a logical volume :

# rmlv lv05

To display the properties of a logical volume :

# lslv lv03

To display info about LV by Physical volume :

# lslv –pv lv03

To display LVs that can be used as backing devices :

# lslv –free

To make a copy for lv01 in hdisk03 :

# mklvcopy lv01 hdisk03

To remove lv01’s copy from hdisk03 :

# rmlvcopy lv01 hdisk03

To copy the contents of lv01 to lv02 :

# cplv lv01 lv02

To copy the contents of lv01 to a new lv in vg01 :

# cplv –vg vg01 lv01

To change the name of oldlv to newlv :

# chlv –lv newlv oldlv

Physical Volume

To display all physical volumes in the system :

# lspv

To display the status and characteristics of hdisk03 :

# lspv hdisk03

To list all the available PVs used as virtual SCSI backing devices :

# lspv –avail

To list PVs that can be used as virtual SCSI backing devices and are not currently a backing device :

# lspv –free

To move physical partitions from hdisk1 to hdisk2 :

# migratepv hdisk1 hdisk2

To move physical partitions in lv01 from hdisk1 to hdisk2 :

# migratepv –lv lv01 hdisk1 hdisk2

Storage Pool Management:

To create storage pool “client_data” using hdisk3 hdisk4 hdisk3 and hdisk4 :

# mksp -f client_data

To set client_data storage pool as default :

# chsp –default client_data

To list all storage pools :

# lssp

To list the default storage pool :

# lssp –default

To list the backing device in rootvg storage pool :

# lssp –bd –sp rootvg

To attach a storage from a storage pool to a Virtual SCSI adapter:

# mkbdsp -bd lv001 -vadapter vthost2 -tn vtscsi9

To removes storage from a Virtual SCSI adapter, and removes the backing device :

# rmbdsp –bd lv001

To remove storage from a Virtual SCSI adapter, And makes sure backing device is not deleted :

# rmbdsp –bd lv001 -savebd

To removes storage from a Virtual SCSI adapter, and removes the backing device :

# rmbdsp –vtd vtscsi9

To removes storage from a Virtual SCSI adapter. and makes sure backing device is not deleted :

# rmbdsp –vtd vtscsi8 -savebd

Network Configuration :

TCP/IP Configation:

To configure tcpip on a network interface :

# mktcpip -hostname sys01vio2 -inetaddr 9.47.90.113 -interface en2 -netmask 255.255.255.0 -gateway 9.47.90.1 -nsrvdomain yahoo.com -start

-

To display the stored tcp/ip configuration in the system :

# lstcpip –stored

To display ethernet adapters on the system :

# lstcpip –adapters

To display the system hostname :

# lstcpip –hostname

To display DNS name servers in search order and domain name :

# lstcpip –namesrv

To display the routing table :

# lstcpip –routtable

To display routing table in numeric output instead of hostname :

# lsctpip –num –routtable

To display all the open inet sockets :

# lstcpip –sockets –family inet

To display the status of all configured interfaces :

# lstcpip –state

To remove all TCP/IP configuration :

# rmtcpip –all

To unconfigure tcpip in en0:

# rmtcpip –interface en0

To cleanup static routing table :

# rmtcpip –f -routing

To remove IP information from en0 after reboot :

# rmtcpip –f –interface en0 -nextboot

To remove DNS information and clears the hosts file :

# rmcpip –namesrv

Managing IP address-to-host name Mapping Entries:

To add IP address-to-host name mapping entry :

# hostmap -addr 192.100.1.7 -host alpha

To list all IP address-to-host name mapping entries :

# hostmap –ls

To delete the IP address-to-host name mapping entry :

# hostmap-rm 192.100.1.7

Managing Network Services:

To enable all the network services :

# startnetsvc ALL

To enable the telnet daemon :

# startnetsvc telnet

To enable the ftp daemon :

# startnetsvc ftp

To enable the ssh daemon :

# startnetsvc ssh

To enable the ldap daemon :

# startnetsvc ldap

To enable the cimserver daemon :

# startnetsvc cimserver

To enable the xntpd daemon :

# startnetsvc xntpd

To send CLI tracing details to the system log :

# startnetsvc tracelog

To send system error to the system log :

# startnetsvc errorlog

To disable all the network services :

# stopnetsvc ALL

To disable the telnet daemon :

# stopnetsvc telnet

To disable the ftp daemon :

# stopnetsvc ftp

To disable the ssh daemon :

# stopnetsvc ssh

To disable the ldap daemon :

# stopnetsvc ldap

To disable the cimserver daemon :

# stopnetsvc cimserver

To disable the xntpd daemon :

stopnetsvc xntpd

To stop sending CLI tracing details to system log :

# stopnetsvc tracelog

To stop sending system error log to the system log :

# stopnetsvc errorlog -

To display the status of ftp network service :

# lsnetsvc ftp

Managing DNS, Domain and Search Order Entries:

To add a domain entry :

# cfgnamesrv -add -dname abc.aus.century.com

To add a name server entry :

# cfgnamesrv –add -ipaddr 192.9.201.1

To display all the DNS entries :

# cfgnamesrv -ls

Network Tuning Parameters:

To display the maximum size of the mbuf pool :

# optimizenet –get thewall

To set a machine as internet work router over TCP/IP networks :

# optimizenet –set ipforwarding=1

To display information on udp_recvspace :

# optimizenet –h udp_recvspace

Network Monitoring:

To display all the statistics, including the device- specific statistics :

# entstat ent0

To reset all the statistics back to their initial values :

# entstat –reset ent0

To display the route to a particular host :

# traceroute nis.nsf.net

System Monitoring :

To display the summary of current system activity :

# sysstat

To display the system statistics :

# topas

System Management Commands:

To halt the operating system :

# shutdown

To halt the operating system forcibly :

# shutdown –force

To reboot the vio server :

# shutdown –restart

To invalidate the boot list for service mode :

# bootlist -mode service –rm

To display the boot list for service mode :

# bootlist -mode service –ls

To set the boot list for normal mode :

# bootlist –more normal hdisk0

To display the complete detailed error report :

# errlog –ls

To remove all the error log entries :

# errlog –rm 0

To remove the error log entries older than 5 days :

# errlog –rm 5

To change the system date and time :

# chdate -day 12 -month 10 -year 2004 -hour 16 -minute 30

To change the language for the entire system to French Canadian :

# chlang -lang fr_CA

To display available languages :

# chlang –ls

To perform hardware problem determination and maintenance :

# diagmenu

To generate report on microcode levels of all the devices :

# invscout –report

To display the vpd survey of the partition :

# invscout –vpd

To append the current MOTD [Message Of The Day] :

# motd –append “Message”

To overwrite MOTD :

# motd –overwrite -file filename

To do the initial configuration of VIO Server :

# cfgassist

It is like configuration assitant in AIX.

To do filesystem scan :

# fsck /dev/lv01

To display exported (nfs) directories on a remote server :

# showmount hostname

To start system dump on the primary device :

# startsysdump

To display continuous disk report on disk1 at 2sec interval :

# viostat -disk disk1 2

To display adapter throughput reports :

# viostat –adapter

To display system and adapter throughput reports :

# viostat –sys –adapter

To gather system info and to store it in the floppy disk :

# snap -general -dev /dev/rfd0

To display microcode levels of all devices :

# lsfware –all

Managing Agents:

To start an agent : # startsvc agent_name

To stop an agent: # stopsvc agent_name

To display an agent's configuration information :

# lssvc agent_name

To display all the available agents :

# lssvc

To display the attributes associated with ITSM_base agent :

# cfgsvc –ls ITM_base

To display the ITM_base agent ssh public key :

# cfgsvc -key ITM_base

User Management:

To create a user :

# mkuser

To change an attribute of a user :

# chuser

To display the properties of a user :

# lsuser

To remove a user from the system :

# rmuser

To set/reset password for a user :

# passwd

Security Commands:

To display all failed logins :

# lsfailedlogin

To display the contents of global command log :

# lsgcl

To displays high system settings :

# viosecure -level high

To apply all of the high system settings to the system :

# viosecure -level high –apply

To displays the current system settings :

# viosecure –view

To allow IP activity on the ftp-data, ftp, ssh, www, https, rmc, and cimon ports, and to deny other IP activity :

# viosecure –firewall on

To enable IP activity on all ports :

# viosecure –firewall off

To display the list of allowed ports :

# viosecure -firewall view

Sunday, August 26, 2007

AIX - Tips n Tricks - Part II

1. How to configure the system and create a restricted shell user ?

Below example shows how to create a restricted shell user (this user can execute only "ls" and "vi" commands

a) Make a reduced bin directory to contain links to programs for the user or users:

# mkdir /usr/rbin

b) Link the necessary commands and programs in the reduced bin directory.

For example, give access to the ls and vi commands:
# ln -s /usr/bin/ls /usr/rbin/ls
# ln -s /usr/bin/vi /usr/rbin/vi

c) Add Rsh as a valid shell in /etc/security/login.cfg:
# vi /etc/security/login.cfg

d) Add /usr/bin/Rsh to the list of shells in the usw stanza:

usw:
shells = /bin/sh,/bin/bsh,/bin/csh,/bin/ksh,/bin/tsh,/bin/ksh93,/usr/bin/sh,
/usr/bin/bsh,/usr/bin/csh,/usr/bin/ksh,/usr/bin/tsh,/usr/bin/ksh93,/usr/sbin/
uucp/uucico,/usr/sbin/sliplogin,/usr/sbin/snapp,/usr/bin/Rsh

e) Add the restricted shell user:
# mkuser shell="/usr/bin/Rsh" alex

f) Assign an initial password:
# passwd alex

g) Change the ownership of the users profile to root:
# chown root:system /home/alex/.profile

h) Change the permissions of the users profile to 755:
# chmod 755 /home/alex/.profile

i) Edit the users profile setting the PATH and Shell variables:

# vi /home/alex/.profile
Set PATH for the new bin directory and Set SHELL to rksh:
PATH=/usr/rbin; export SHELL=/usr/bin/Rsh

---------------------------------------------------------------------------­---------------------------------

2. How to change the default welcome (herald) message on the login display ?

Edit the file /etc/security/login.cfg and update the herald parameter ...

default:
herald = "Unauthorized use of this system is prohibited\n\nlogin: "
sak_enable = false
logintimes =
logindisable = 0
logininterval = 0
loginreenable = 0
logindelay = 0

You can also use the below command to change the herald value

# chsec -f /etc/security/login.cfg -a default -herald "Unauthorized use of this system is prohibited.\n\nlogin: "

---------------------------------------------------------------------------­---------------------------------

3. How to set automatic logoff (only for terminals) ?

Edit the /etc/security/.profile file to include an automatic logoff value for all users, as in the following example:

TMOUT=600 ; TIMEOUT=600 ; export readonly TMOUT TIMEOUT

The number 600, in this example, is in seconds, which is equal to 10 minutes. However, this method only works from the shell.

---------------------------------------------------------------------------­---------------------------------

4. How to auto forward the mails ?

Create $HOME/.forward file and add adresses or aliases.

When mail is sent to a local user, the sendmail command checks for the $HOME/.forward file.

If the file exists, the message is not sent to the user. The message is sent to the addresses or aliases in the $HOME/.forward file.

---------------------------------------------------------------------------­---------------------------------


5. How to set(define) and unset a variable in a shell or shell script ?

# x=3 -> Defines a vlue for a variable 'x'
# echo $x -> Displays the vlue of 'x' vairable
3
# unset x -> Unsets the variable
# echo $x -> Again display its value
#

---------------------------------------------------------------------------­---------------------------------


6. How to send file1 as a message to user alex ?

# mail alex <>

---------------------------------------------------------------------------­---------------------------------


7. How to display mail queue ?


Note: mailq is the queue where your mails are stored

# mailq (or) sendmail -bp

There is 1 request in the mail queue
---QID---- --Size-- -----Q-Time----- ----------Sender/ Recipient-----------
OAA 19258 * 29 Mon Jun 26 14:57 root

---------------------------------------------------------------------------­---------------------------------


8. Whats sendmail command?

It receives formatted messages and routes messages to one or more users. IT can deliver messages to users on local/remote machines. It will be started by tcpip sub-system . It uses /etc/mail/sendmail.cf as config file.

Once this daemon started, you can find its process id in

/etc/sendmail.pid.


---------------------------------------------------------------------------­---------------------------------


9. How to define mail aliases for users?

a) Add the aliases to /etc/aliases.
For Example,
nobody: /dev/null
certify: user02, user5801@server3, root@server4, user5911@se

b) Rebuild the aliases database using
newaliases (or) sendmail -bi

---------------------------------------------------------------------------­---------------------------------


10. If logging with telnet takes long time (for ex. 2 mins), what might be the issue?

There might be problem with DNS resolution. Check /etc/resolv.conf and check dns connection thru nslookup command.

---------------------------------------------------------------------------­---------------------------------

11. While attempting to log in, you see the below message. How you solve this issue ?

'All available login sessions are in use.'

Check the number of AIX user license using "lslicense"
If required increase the license using "chlicense" command.

---------------------------------------------------------------------------­---------------------------------

12. Oracle DBA says that his database is not able to go beyond certain limit. For example, oracle userid is not able to start more than 500 process's. Whats the issue?

This is because of the "maxuproc" value is 500. Check the value using "lsattr -El sys0 -a maxuproc"

If required change the value using
# chdev -l sys0 -a maxuproc=1000

Normally for Oracle Production machines, you have to consult with DBA's while installing the server and set an agreed value.

---------------------------------------------------------------------------­---------------------------------

13. Errpt is not displaying any reports. Found that /var/adm/ras/ errlog file is there in the location and errdemon is running fine. What might be the issue the issue?

errlog file seems to be corrupted. Delete the file and stop the errdemon (/usr/lib/errstop).

Start the errdaemon (/usr/lib/errdemon). While starting, daemon creates the errlog file automatically.

---------------------------------------------------------------------------­---------------------------------

14. How to list IDE controllers in your system ?

# lscfg -l ide*

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

The following sample display from the lscfg -l ide command shows

There are 2 IDE I/O controllers configured in the server

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.

---------------------------------------------------------------------------­---------------------------------

15. 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 do you suppress these messages?

You can suppress these messages by creating a “.hushlogin” file in your home directory.

For Example,

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.

---------------------------------------------------------------------------­---------------------------------

16. Whats the files system read once you login ?

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.

---------------------------------------------------------------------------­---------------------------------

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

A fourth file that the operating system uses at login time 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.

---------------------------------------------------------------------------­---------------------------------

18. 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.

---------------------------------------------------------------------------­---------------------------------

19. 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 practice to run using nohup,

# 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.

This will help you in case if you want to start backup using mksysb and close your terminal/ 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.

---------------------------------------------------------------------------­---------------------------------

20. What is 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 high priority while using resources.

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.

---------------------------------------------------------------------------­---------------------------------

21. How to stop, resume 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 process id which can be obtained from the following command

ps -ef | grep precess_name | awk '{print $2}'

---------------------------------------------------------------------------­---------------------------------

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

Normally usage of output redirection suppresses 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

---------------------------------------------------------------------------­---------------------------------

23..How to capture your 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.

---------------------------------------------------------------------------­---------------------------------

24. 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

---------------------------------------------------------------------------­---------------------------------

25. 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

---------------------------------------------------------------------------­---------------------------------

26. 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

---------------------------------------------------------------------------­---------------------------------

27. 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.

---------------------------------------------------------------------------­---------------------------------

28. What the RAID groups AIX LVM supports?

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

---------------------------------------------------------------------------­---------------------------------

29. 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

Here 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

---------------------------------------------------------------------------­---------------------------------

30. After logging as an application user (oradba), when I issued "crontab -l" system throwed the below error

0481-103 Cannot open a file in the /var/spool/cron/crontabs directory.

What is the solution?

Here is the solution

a) Create an empty file /var/spool/cron/crontabs/oradba

b) Change the ownership of the file to root.cron

c) Login as oradba and issue "crontab -l" to verify the cron.

---------------------------------------------------------------------------­---------------------------------

31. How to identify the program listening in the given port ?

METHOD I: # lsof –P –n –i :505 (for port 505)

METHOD II:

# netstat -Aan|grep 9404

f100060006952b98 tcp 0 0 *.9404 *.* LIST

EN

f100060006a90b98 tcp 0 0 *.19404 *.* LIST

EN

# rmsock f100060006952b98 tcpcb

The socket 0x6952808 is being held by proccess 753870 (java).

---------------------------------------------------------------------------­---------------------------------

32. How to display non-printable characters in a text file ?

Lets create a file with non-printable characters.

# vi filename.txt

^I^I^I^I$

$

$

$

this is a test$

^I^I^I^I$

~

: set list

Now we will list the file so that non-printable chars are viewed

# cat -vet filename.txt

^I^I^I^I$

$

$

$

this is a test$

^I^I^I^I$

# od -c filename.txt

0000000 \t \t \t \t \n \n \n \n t h i s i s

0000020 a t e s t \n \t \t \t \t \n

0000034

---------------------------------------------------------------------------­---------------------------------

33. How to display specific lines in a text files ?

For illustration purposes, I'm using the cat -n filename to show the line numbers in this script.

# cat -n filename

...

8 for i in $*

9

10 do

11

12 typeset -i16 hex

13 hex=$i

14 print $i equals $hex in hexadecimal

15

16 typeset -i8 oct

17 oct=$i

18 print $i equals $oct in octal

19

20 typeset -i2 bin

21 bin=$i

22 print $i equals $bin in binary

23

24 print

25 done

...

Prints out the for loop without displaying the line numbers

# sed -n 8,25p filename | tee for_loop

---------------------------------------------------------------------------­---------------------------------

34. How to recover the root password in AIX ?

If you forgotten the root password, we can easily recover it but the system requires 2 recycles.

Here is the way I follow

Password recovery is one of the simplest troubleshooting procedure in
AIX. Once you boot from CD, you see a menu with 3 menu items.

In that select the 3rd item

ie., "Start Maintenance Mode for System Recovery" à

"Access a Root Volume Group" ->

"Access this volume group and start a shell".

This will open a shell prompt. The just use "passwd" command for
setting a new password for root.

Thats it. root password has been changed.

Now you can reboot the machine from rootvg hard disk (normally it should be hdisk0)

---------------------------------------------------------------------------­---------------------------------

34. How to find out the (real) memory usage ?

# svmon -G

size inuse free pin virtual

memory 2097152 2097026 126 195637 1237158

pg space 524288 61023

work pers clnt lpage

pin 195404 233 0 0

in use 1189840 906786 400 0

The size and inuse columns of the memory and pgspace output represent real memory and paging space usage respectively.

The size is measured as the number of 4K pages.

Here in this case used memory is

= ((2097026 x 4)/1024)/1024 GB of used memory

---------------------------------------------------------------------------­---------------------------------

35. Here are some of the errors you get when paging space is low.

INIT: Paging space is low!

ksh: cannot fork no swap space

Not enough memory

Fork function failed

fork () system call failed

Unable to fork, too many processes

Fork failure - not enough memory available

Fork function not allowed. Not enough memory available.

---------------------------------------------------------------------------­---------------------------------

36. How is the default paging space size determined ?

It follows the following standard

  • Set paging space to 2 times the amount of RAM
  • Paging space can use no more than 20% of total disk space in the root volume Group
  • Paging space can be no larger than 2 GB

Friday, July 6, 2007

PowerPATH - Some commands

INSTALLATION:

1. Required Filesets:

EMCpower.base 3.0.0.0
EMCpower.multi_path_clariio 3.0.0.0
EMCpower.multi_path 3.0.0.0
EMCpower.consistency_grp 3.0.0.0

2. Register PowerPath on the host.

Enter the 12-character license key using the below command.
# emcpreg -install

3. Validate your registration number using
# powermt check_registration

4. Initialize the PowerPath hdiskpower devices and make them available to the host.

To initialize devices at the command line, enter:
# powermt config


Maintenance Commands:

Equivalent to cfgmgr:
# emc_cfgmgr

To display hdiskpowern to hdiskn configuration:
# powermt display dev=all

Reconfigure or create the hdiskpower devices
# powermt config

To list HBA:
# powermt display

To remove HBA:
# powermt remove hba=hba#

Test all configured paths:
# powermt restore

To remove any hdiskpower devices that are no longer available:
# powermt check

Uninstallation:

a) Stop all applications/processes that access powerpath hdiskpower device.
b) Varyoff volumegroups that contains hdiskpower device (or) remove hdiskpower devices from the volumegroups

c) Uninstall powerpath filesets using
# installp –u EMCpower

d) If you wanna remove powerpath from the system entirely, remove the file “/etc/emcp_registration”

Thursday, July 5, 2007

AIX - Tips n Tricks - Part I

1. To confirm which network adapter is plugged into the switch in IBM AIX

Try this next time to confirm what adapter is actually plugged in to a switch:

This will not only tell you where you have a connection but it will also tell you what speed the port on the switch is.


# netstat -v grep -E "ETHERMedia"
ETHERNET STATISTICS (ent0) :
Media Speed Selected: 100 Mbps Full Duplex
Media Speed Running: 100 Mbps Full Duplex
ETHERNET STATISTICS (ent1) :
Media Speed Selected: 1000 Mbps Full Duplex
Media Speed Running: 1000 Mbps Full Duplex


----------------------------------------------------------------------------------------------------------------

2. How to determine if IBM AIX 64 bit kernel (sotware) is installed on your IBM AIX server?

# lslpp -l bos.64bit

bos.64bit 4.3.3.76 COMMITTED Base Operating System 64 bit

----------------------------------------------------------------------------------------------------------------

3. How you create a snapshot of your IBM AIX server to send to IBM for tech support ?

This is requried whenver you face issues with your server and you seek help from IBM to sort out the issue.

# snap -gc

This will create a file called snap.pax.Z in the directory /tmp/ibmsupt. Send this file to IBM so that they will get full configuration of your server.

----------------------------------------------------------------------------------------------------------------

4. How to enable entended history in AIX 5.3 ?

In AIX 5.3, you have the capability to have a time stamped history. To enable it, just set the following variable:
EXTENDED_HISTORY=ON

Example:
export EXTENDED_HISTORY=ON

If required add this line to your .profile.

----------------------------------------------------------------------------------------------------------------

5. How to find the microcode level of tape drives ?


To find microcode level (firmware) of tape drives in IBM AIX:
# tapeutil -f /dev/rmt1 vpd

----------------------------------------------------------------------------------------------------------------


6. pgrep and pkill - how to terminate processes ?

You can use the pgrep and pkill commands to identify and stop command processes that you no longer want to run. These commands are useful when you mistakenly start a process that takes a long time to run.

To terminate a process:
a. pgrep - to find out the PID(s) for the process(es)
b. pkill - followed by the PID(s)

The following example illustrates how to find all the processes with a specific name (xterm) and terminate the xterm process that was started last.
# pgrep xterm 17818 17828 17758 18210
# pkill -n 18210


Note: If you need to forcibly terminate a process, use the -9 option to the pkill command.


For Example
# kill -9 -n xterm

----------------------------------------------------------------------------------------------------------------

7. How to modify Asynchronous I/O variables in AIX ?


To modify the minservers asynchronous I/O variable (MINIMUM number of servers) in IBM AIX:
# chdev -l aio0 -a minservers='1'

To modify the maxservers asynchronous I/O variable (MAXIMUM number of servers per cpu) in IBM AIX 5L:
# chdev -l aio0 -a maxservers='10'

To modify the maxservers asynchronous I/O variable (MAXIMUM number of servers) in IBM AIX v4.3:
# chdev -l aio0 -a maxservers='80'

To modify the requests asynchronous I/O variable (Maximum number of REQUESTS) in IBM AIX:
# chdev -l aio0 -a requests='4096'

Notes:

1) Valeus will only take effect after a reboot
2) You may use multiple -a options on the same command line3)

The maxservers variable is PER CPU for AIX 5L and TOTAL for AIX v4.3

----------------------------------------------------------------------------------------------------------------

8. How to display microcode and firmware levels of the system and adapters in IBM AIX ?


To displays microcode level information for all supported devices in IBM AIX :

# lsmcode -A
sys0!system:SF240_284 (t) SF240_261 (p) SF240_284 (t)
ent0!14108902.DV0210
ent1!14108902.DV0210
ent2!14108902.DV0210
ent3!14108902.DV0210
sisscsia0!44415254.05080064
sisscsia1!44415255.050A0064
hdisk0!ST37320.4A553042.43373038
hdisk1!ST37320.4A553042.43373038

----------------------------------------------------------------------------------------------------------------

9. How to determine if simultaneous multi-threading (SMT) is enabled in AIX ?

Your system is capable of SMT if it's a POWER5-based system running AIX 5L Version 5.3.To determine if it is enabled:# smtctl

To enable SMT: # smtctl -m on [ -w boot now]
To disable SMT: # smtctl -m off [ -w boot now]

Note: If neither the -w boot or the -w now options are specified, then the mode change is made immediately. It persists across subsequent reboots if you run the bosboot command before the next system reboot.

----------------------------------------------------------------------------------------------------------------

10. How to find top users of memory space in IBM AIX ?

To list the top ten users of paging space in IBM AIX:
# svmon -Pgt 10

To list the top ten users of realmem in IBM AIX:
# svmon -Put 10

----------------------------------------------------------------------------------------------------------------

11. How to list the filesystems in a volume group in IBM AIX ?

# lsvgfs volume_group

----------------------------------------------------------------------------------------------------------------

12. How to query the volume group descriptor area on a drive in IBM AIX ?

To query the volume group descriptor area on the drive, so you can find out if there's a VG on the disk, even if there isn't anything imported on the drive in IBM AIX:

# lqueryvg -Atp hdisk#

----------------------------------------------------------------------------------------------------------------

13. How to set IBM AIX for full core dumps and files to unlimited

To set IBM AIX for full core dumps to unlimited:
# ulimit -c unlimited

To set IBM AIX for files to unlimited:
# ulimit -f unlimited

To view your ulimit settings:
# ulimit –a

----------------------------------------------------------------------------------------------------------------

14. How to determine what the speed and duplex is of an interface in AIX ?

# entstat -d en0 grep "Media Speed"

------------------------------------------------------------------------------------------------

15. How to find the highest technology level and service pack installed in IBM AIX ?

Starting in 2006, in IBM AIX, a Maintenance Level will be referred to as a Technology Level and will only be released twice per year.

The Service Pack concept will allow service-only updates (as known as PTF’s) that are released between Technology Levels to be grouped together for easier identification.
Sample output for a V5.3 system, with Technology Level 4, and Service Pack 2 installed would be:

# oslevel –s

----------------------------------------------------------------------------------------------------------------

16. How to find number of active processors in IBM AIX ?

To find the number of active processors in IBM AIX:
# bindprocessor -q
The available processors are: 0 1 2

To find the number of processors installed (but not necessarily available):

# lscfg -v grep proc
proc0 00-00 Processor
proc2 00-02 Processor
proc4 00-04 Processor

----------------------------------------------------------------------------------------------------------------

17. How to read the contents of /etc/security/failedlogin in IBM AIX ?
# who /etc/security/failedlogin# /usr/sbin/acct/fwtmp < /etc/security/failedlogin


----------------------------------------------------------------------------------------------------------------

18. How to reserve or lock a terminal under AIX 5L ?

This command will lock your terminal and reserve it for later use in AIX 5L

# lock
# lock -30 (lock for 30 minutes)

Note: default lock time is 15 mintes lock will ask you for a password twice then lock the terminal. you can unlock it by entering the password a third time.

----------------------------------------------------------------------------------------------------------------

19. How to stop IBM AIX from forcing a user to change their password at first login ?

# pwdadm -c username

----------------------------------------------------------------------------------------------------------------

20. Redhat Package Manager for IBM AIX and Linux

To query all packages installed:
# rpm -q –a

To list file in a specific package:
# rpm -q -l package.rpm

To install a RPM package:
# rpm -i package.rpm

To delete (erase) a RPM package:
# rpm -e package.rpm

To query for RPM package owning file:
# rpm -q -f /path/to/file

To upgrade a RPM package
# rpm -U package.rpm

----------------------------------------------------------------------------------------------------------------

21. How to capture TCPIP packet information in IBM AIX ?

Here is a command to capture TCP/IP packet information between your server and another in IBM AIX:


Become root user, Find a temporary directory to capture the data (/tmp in this example) Run the iptrace command:

# iptrace -a -d host_destination -b /tmp/ip.out

iptrace will run in the background and results will be in /tmp/ip.out

To see the results of the trace:
# ipreport /tmp/ip.out more

Don't foregt to kill iptrace when you're done:
# ps -ef grep iptrace grep -v grep awk '{system("kill " $2)}'

Some other cool options of iptrace:
-d : specify destination IP address -s : specify origin IP address
-b : show 2-way traffic (as in "-s xxx -b" or "-d xxx -b")
-a : no ARP requests (less pollution in the trace)

To see all packets going in and out of server, unixserv, without ARP requests:

# iptrace -a -d unixserv -b /tmp/ip.out

iptrace and ipreport are in IBM AIX LPP "bos.net.tcp.server"

----------------------------------------------------------------------------------------------------------------

22. How to check if a system dump completed successfully on IBM AIX ?

To verify if a system dump completed successfully on an IBM AIX server:

# sysdumpdev –L
0453-039
Device name: /dev/hd6
Major device number: 10
Minor device number: 1
Size: 124371456 bytes
Date/Time: Sun Sep 15 12:19:02 EDT 2002
Dump status: 0 ( 0 = Ok)
dump completed successfully
0481-195
Failed to copy the dump from /dev/hd6 to /var/adm/ras

----------------------------------------------------------------------------------------------------------------

23. How to check two file systems simultaneously on different drives in IBM AIX ?

To check two file systems simultaneously on different drives in IBM AIX.The dfsck command permits you to interact with two fsck commands at once. To aid in this, the dfsck command displays the file system name with each message. When responding to a question from the dfsck command, prefix your response with a 1 or a 2 to indicate whether the answer refers to the first or second file system group.

# dfsck [ FlagList1 ] FileSystem1 [ FlagList2 ] FileSystem2

Example to check two filesystems:
# dfsck -p /dev/hd1 - -p /dev/hd7

Note: you can also specify the file system names found in the /etc/filesystems. Attention: Do not use the dfsck command to check the root file system.

----------------------------------------------------------------------------------------------------------------

24. How to make a disk flash in IBM AIX ?

For disk replacement, it is often useful to make the disk flash so that you know which disk to replace in IBM AIX:

# diag to continue
Select "Task Selection (Diagnostics, Advanced Diagnostics, Service Aids, etc.)"
Select "Hot Plug Task"Select "SCSI and SCSI RAID Hot Plug Manager"
Select "Identify a Device Attached to a SCSI Hot Swap Enclosure Device"

Select the slot you wish the disk to flash Replace the appropriate disk by checking which disk is flashing

----------------------------------------------------------------------------------------------------------------

25. How to determine which application created the OS core file in AIX ?

# /usr/sbin/lquerypv -h /path/to/core 6b0 64
The output of this command is neat, clean and easy to read.

Here is an example:

# lquerypv -h core 6b0 64
000006B0 7FFFFFFF FFFFFFFF 7FFFFFFF FFFFFFFF ................
000006C0 00000000 000007D0 7FFFFFFF FFFFFFFF ................
000006D0 00120000 1312C9C0 00000000 00000017 ................
000006E0 6E657473 63617065 5F616978 34000000 netscape_aix4...
000006F0 00000000 00000000 00000000 00000000 ................
00000700 00000000 00000000 00000000 00000ADB ................
00000710 00000000 000008BF 00000000 00000A1E ................


The executable is located between the pipes on the right hand side of the output. In this case, the core was generated by Netscape.

----------------------------------------------------------------------------------------------------------------

26. How to find the system id number of an IBM AIX server ?

# lsattr -El sys0 -a systemid
# uname -u
# lscfg -vpgrep -p "System VPD:" grep -i Serial

Note: commands may not work on all IBM models

----------------------------------------------------------------------------------------------------------------

27. Tips on Memory Tuning :

Do not use the command vmtune in AIX 5L. From AIX 5L. vmo and ioo commands are introduced to tune memory and I/O.

Here is how we set various memory options now:

# vmo -p -o maxfree=128
# vmo -p -o minperm%=5
# vmo -p -o maxclient%=10
# vmo -p -o maxperm%=10
# vmo -p -o maxfree=632
# vmo -p -o minfree=600
# ioo -p -o maxpgahead=32


To see the results of the changes:
# vmo –L
# ioo –L


If you have a problem with slow telnet sessions:
# chdev -l sys0 -a maxpout='33' -a minpout='24'

To set AIO (asynchronous IO) options use smitty

----------------------------------------------------------------------------------------------------------------

28. If you reinstall an IBM AIX server and the mksysb used was for a server on another vlan, you can end up with 2 default routes. Lets see how to solve this issue
In order to see the default routes stored in the ODM:

# lsattr -El inet0 grep Route
route net,-hopcount,0,,0,172.26.247.92 Route True
route net,-hopcount,0,,0,172.26.14.1 Route True


To see the default routes you have in your routing table:
# netstat -rn grep default
default 172.26.14.1 UGc 0 0 en0 - - =>

default 172.26.247.92 UGc 0 0 en0 - -

To remove one of the default routes, use smitty and not a the route command otherwise you will end up with 2 default routes after a reboot.

----------------------------------------------------------------------------------------------------------------

29. EFix - How to manage ?

To list efix :
# emgr –l

To install an efix package:
# emgr -e efixPackage

----------------------------------------------------------------------------------------------------------------

30. Kernel Processes in AIX: An Overview

# ps -kl
# pstat -a
(as root)

There are several kprocs, and they do a number of things. Often they have fixed priority and will run ahead of any user processes.

A couple are:
Kproc Kernel (wait) wait process
Kproc Kernel (lrud) Least Recently Used Daemon (mem mgmt)
Kproc Kernal (swapper) Memory/Process swapping ?
Kproc Kernel (kbiod) Kernel Block I/O daemon (disk I/O)?
kproc Kernel ( gil) 1032 Networking off-level stuff
Kproc Kernel (netm) Network memory allocator
Kproc Kernel (aump) Automounter

A kproc is a kernel process, started by the kernel on behalf of either another kernel process, or as a result of an application initiating a system call or call to a kernel service.
Wait - You will find that the "wait" kproc will have accumulated a lot of cpu time. This just means your system is idle a lot. When nothing else needs to run, the wait kproc is charged the time slice

GIL - "Global ISR List"
ISR->Interrupt Service Routines - multithreaded kproc runs at fixed pri of 37 Used to process various timers (tcp, streams, ....) and also used to pass packets from demux layer to IP layer for non-CDLI drivers.

ps -lk
The processes with nice value of -- are running with fixed priorities. Their nice values can not be changed. On my system that would processes such as swapper (pid=0, pri=16) and the wait kproc (pid=514, pri=127).

This will list out all the kprocs. Now do a pstat -a to find what they really are?
This will show you the real name of the kproc.

Aump kernel thread is left over after you stop the automounter daemon.
Yes. It goes away after reboot. However, there is an APAR for it: IY33240

----------------------------------------------------------------------------------------------------------------

31. How to manage network tuning parameters in AIX ?

The no command is used to configure network tuning parameters in IBM AIX. The no command sets or displays current or next boot values for network tuning parameters. This command can also make permanent changes or defer changes until the next reboot.

Syntax:
no [ -p -r ] { -o Tunable[=NewValue] }
no [ -p -r ] {-d Tunable }
no [ -p -r ] { -D }
no [ -p -r ] -a
no -h [ Tunable ]
no -L [ Tunable ]
no -x [ Tunable ]

where:
-a : displays current, reboot or permanent value for all tunable parameters
-d : resets Tunable its to default value
-D : resets all tunables to their default value
-h : displays help about Tunable parameter
-L : lists the characteristics of one or all Tunables
-o : displays the value or sets the Tunable to NewValue
-p : makes changes apply to both current and reboot values (I heard this option in many interviews)
-r : makes changes apply to reboot values (I heard this option in many interviews)
-x : lists characteristics of one or all tunables using spreadhset format

Example to set the value of tunable tcp_sendspace to 65536 permanently:
# no -p -o tcp_sendspace=65536

Example to set the value of tunable sb_max to 2097152 at next reboot:
# no -r -o sb_max=2097152

Example to display all values of tunables:
# no -a

Example to display all values of tunables at next reboot:
# no -r -a

Example to set the value of tunable tcp_sendspace to 65536:
# no -o tcp_sendspace=65536

----------------------------------------------------------------------------------------------------------------

32. How to verify your ntp setup is working properly ?

# ntpq -c peersremote refid st t when poll reach delay offset disp =========================================================================
*time.domain.co doghaus.cns.uto 3 u 12 64 177 1.46 -2.515 145.19

If you have a star (*) in the first column of the name of the time server, your time is being synchronised properly.

The third column, st, is the stratum. The lower the number, the closer you are to the time source.

Stratum 16 means you are not synchronised.

----------------------------------------------------------------------------------------------------------------

33. How to syncronise your server time to a time server ?

If you don't want to run NTP (network time protocol), you can update your system time with the command:

# ntpdate timeserver.domain.com

----------------------------------------------------------------------------------------------------------------

34.How to list open files ?

To list all open files:
# lsof

To list all open files on a device:
# lsof /dev/hd4

----------------------------------------------------------------------------------------------------------------

35. How to find the world-wide name (WWN) or network address of a fibre-channel (FC) card in IBM AIX ?

First find the name of your fibre-channel cards:
# lsdev -vp grep fcs

Then get the WWN (for fcs0 in this example):
# lscfg -vp -l fcs0 grep "Network Address"

----------------------------------------------------------------------------------------------------------------

36. How to change a server hostname with the uname command in IBM AIX ?

To display the current hostname
# uname -n
localhost

To change the hostname
# uname -S newhostname

Again display the hostname
# uname -n
newhostname

----------------------------------------------------------------------------------------------------------------
37. How can you find out when a system was installed?
Enter the following command:
lslpp -h bos.rte
The output of this command will show the history of when the operating system was installed. Read the entry for the AIX level (ie, 4.3.3.0).

----------------------------------------------------------------------------------------------------------------

38. How to make sure all of the user definitions are correct in the user database

#usrck -n ALL

Do the same for the groups:
#grpck -n ALL

----------------------------------------------------------------------------------------------------------------

39. Reduce the Size of a File System in Your Root Volume Group ?
http://publib16.boulder.ibm.com/pseries/en_US/infocenter/howto/HT_baseadmn_rootvg_reduce.htm#baseadmn_rootvg_reduce
----------------------------------------------------------------------------------------------------------------

40.How to reset an Unknown Root Password ?
http://publib16.boulder.ibm.com/pseries/en_US/infocenter/howto/HT_baseadmn_recoverrootpswd.htm#baseadmn_recoverrootpswd
----------------------------------------------------------------------------------------------------------------

41. How to configure Domain Name Servers ?
http://publib16.boulder.ibm.com/pseries/en_US/infocenter/howto/HT_commadmn_dns.htm#commadmn_dns

-----------------------------------------------------------------------------------------------------------------

42. How to re-create corrupted boot image ?
http://publib16.boulder.ibm.com/pseries/en_US/infocenter/howto/HT_baseadmn_bad_boot_img.htm#baseadmn_bad_boot_img
----------------------------------------------------------------------------------------------------------------

43. How to configure NIM master server using EZNIM ?
http://publib16.boulder.ibm.com/pseries/en_US/infocenter/howto/HT_insgdrf_configure_eznim.htm#insgdrf_configure_eznim
----------------------------------------------------------------------------------------------------------------

44. How do I use network (For normal users)


http://publib16.boulder.ibm.com/pseries/en_US/infocenter/howto_user/Use_Network_U.htm#category_use_network

----------------------------------------------------------------------------------------------------------------
45. How do I view system and environment information?
http://publib16.boulder.ibm.com/pseries/en_US/infocenter/howto_user/AccessSys_Envir_U.htm#category_accesssys_envir
----------------------------------------------------------------------------------------------------------------

46. How do I use shell scripts ?
http://publib16.boulder.ibm.com/pseries/en_US/infocenter/howto_user/Use_Shells_U.htm#category_use_shells
----------------------------------------------------------------------------------------------------------------

47. How do I redirect standard input, output, and error?
http://publib16.boulder.ibm.com/pseries/en_US/infocenter/howto_user/RedirStand_IO_Error_U.htm#category_redirstand_io_error
------------------------------------------------------------------------------------------------

48. How do I make my system more secure?
http://publib16.boulder.ibm.com/pseries/en_US/infocenter/howto_user/Security_U.htm#category_security



----------------------------------------------------------------------------------------------------------------


49. How to configure network adapters for Redundancy ?
http://users.ca.astound.net/~baspence/AIXtip/etherchannel.htm

----------------------------------------------------------------------------------------------------------------

50. Useful link about AIX Error Log codes, LED codes, 7-Digit Error codes.
http://rainsux.dyndns.org/AIX5L-Messages-Codes.html

----------------------------------------------------------------------------------------------------------------

51. How to disable remote root login ?


When multiple users have root access to a system, a common security question is who logged in as root? One alternative is to disable remote logins for the root id (chuser -rlogin=false root). This forces users to first login in with their regular user id, then "su -" to root. All "su" activity is captured in /var/adm/sulog, thus answering the question of "who logged in as root."
Comment: In general it is a good practice to disable root remote access as it provides two layers of password protection.


----------------------------------------------------------------------------------------------------------------

52. Replacing a disk drive in AIX.

http://users.ca.astound.net/~baspence/AIXtip/download/failed_disk.pdf

----------------------------------------------------------------------------------------------------------------

53. How to enabling Non-root Users to Administer Passwords ?


The AIX pwdadm command can be used to offload password administration to non-root administrators. The pwdadm command allows the administrator to change anothers password, or force users to change their password at the next login. To enable a non-root administrator to use pwdadm, simply add their ID to the "security" group.
For more information:
http://www.rs6000.ibm.com/doc_link/en_US/a_doc_lib/cmds/aixcmds4/pwdadm.htm

----------------------------------------------------------------------------------------------------------------

54. Fun with device locations


Here are a few commands to locate physical devices. These commands are useful in a partitioned environment where locations are virtual.
lsdev -Cc adapter -s pci - list all adapter slots lsdev -p adapter - lists devices owned by an adapter lsdev -Cl adapter -F parent lists the parent adapter for a device (like a disk drive) lsdev -Cl adapter - virtual device location (for LPARs) lscfg -vl adapter - actual device location So, for example, to locate the physical adapter connected to hdisk0:
# Identify the parent adapterlsdev -Cl hdisk0 -F parent
# Locate the parent adapter lscfg -vl parent

----------------------------------------------------------------------------------------------------------------

55. How to automate setting passwords ?

The "chpasswd" command is easier to use than "passwd" when setting a list of user passwords. It can be used from the command line or shell script. For example, to change passwords for users listed in a file, type the following
cat mypasswords chpasswd
Where the mypasswords file contains
user1:password1user2:password2......

For more information see the following URL

http://publib16.boulder.ibm.com/doc_link/en_US/a_doc_lib/cmds/aixcmds1/chpasswd.htm

----------------------------------------------------------------------------------------------------------------


56. How to list files if 'ls' is missing or corrupt ?
echo *

----------------------------------------------------------------------------------------------------------------

57. How to change the timezone and language in /etc/environment ?
chtz (timezone eg GMT0BST)
chlang (language eg En_GB)

----------------------------------------------------------------------------------------------------------------

58. Find large files

How do you find really large files in a file system:

find . -size +1024 -xdev -exec ls -l {} \;

The -xdev flag is used to only search within the same file system, instead of traversing the full directory tree. The amount specified (1024) is in blocks of 512 bytes.

----------------------------------------------------------------------------------------------------------------


59. Montoring a system without logging in

Let's say you have a helpdesk, where they must be able to run a script under user-id root to check or monitor a system:

First, create a script, you wish your helpdesk to run.

Modify your /etc/inetd.conf file and add:
check stream tcp wait root /usr/local/bin/script.sh
where script.sh is the script you've written.

Modify your /etc/services file and add:
check 4321/tcp

You may change the portnumber to anything you like, as long as it's not in use.

Now, you may run:
telnet [system] 4321
and your script will be magically run and it's output displayed on your screen. If the output of the script isn't displayed on your screen very long, just put a sleep command at the end of your script.

----------------------------------------------------------------------------------------------------------------

60. Changing maxuproc requires a reboot?

When you change MAXUPROC (Maximum number of processes allowed per user), the smitty help panel will tell you that changes to this operating system parameter will take effect after the next system reboot.

This is wrong Help information. The change takes effect immediately, if MAXUPROC is increased. If it is decreased, then it will take effect after the next system reboot.

This help panel text from smitty will be changed in AIX 5.3. APAR IY52397.

----------------------------------------------------------------------------------------------------------------

61. Defunct processes

Defunct processes are commonly known as "zombies". You can't "kill" a zombie as it is already dead. Zombies are created when a process (typically a child process) terminates either abnormally or normally and it's spawning process (typically a parent process) does not "wait" for it (or has yet to "wait" for it) to return an exit status.

It should be noted that zombies DO NOT consume any system resources (except a process slot in the process table). They are there to stay until the server is rebooted.

Zombies commonly occur on programs that were (incompletely) ported from old BSD systems to modern SysV systems, because the semantics of signals and/or waiting is different between these two OS families.

------------------------------------------------------------------------------------------------

62. DLpar with DVD-ROM

Adding a DVD-ROM with DLpar is very easy. Removing however, can be somewhat more difficult, especially when you've run cfgmgr and devices have been configured.

This is how to remove it:
#rmdev -dl cd0

(Remove all cdrom devices found with lsdev -Cc cdrom)

#rmdev -dl ide0

Then remove the devices found with

# lsdev -C grep pci

All PCI devices still in use, can not be removed. The one not in use, is the PCI device where the DVD-ROM drive on was configured. You have to remove it before you can do a DLPAR remove operation on it.

Now do your DLPAR remove operation n HMC

------------------------------------------------------------------------------------------------

63. How do you send an attachment via mail from AIX ?

Uuencode is the answer:

uuencode [source-file] [filename].b64 mail -v -s "subject" [email-address]

For example:

# uuencode /etc/motd motd.b64 mail -v -s "Message of the day" email@hostname.comI

use the .b64 extension which gets recognized by Winzip. When you received your email in Outlook, you will have an attachment, which can be opened by Winzip.

------------------------------------------------------------------------------------------------

64. FTP umask

A way to change the default 027 umask of ftp is to change the entry in /etc/inetd.conf for ftpd:

ftp stream tcp6 nowait root /usr/sbin/ftpd -l -u 117

This will create files with umask 117 (mode 660).

Using the -l option will make sure the FTP sessions are logged to the syslogd. If you want to see these FTP messages in the syslogd output, then you should add in /etc/syslog.conf:

daemon.info [filename]

------------------------------------------------------------------------------------------------