Monday, August 18, 2008

How to remove a dynamically allocated i/o slot in a DLPAR in IBM AIX

To remove a dynamically allocated I/O slot (must be a desired component) from a partition on a P-series IBM server partition:

1) Find the slot you wish to remove from the partition:

# lsslot -c slot
# Slot Description Device(s)
U1.5-P2/Z2 Logical I/O Slot pci15 scsi2
U1.9-P1-I8 Logical I/O Slot pci13 ent0
U1.9-P1-I10 Logical I/O Slot pci14 scsi0 scsi1

In our case, it is pci14.

2) Delete the PCI adapter and all of its children in AIX before removal:

# rmdev -l pci14 -d -R
cd0 deleted
rmt0 deleted
scsi0 deleted
scsi1 deleted
pci14 deleted

3) Now, you can remove the PCI I/O slot device using the HMC:

a) Log in to the HMC

b) Select "Server and Partition", and then "Server Management"

c) Select the appropriate server and then the appropriate partition

d) Right click on the partition name, and then on "Dynamic Logical Partitioning"

e) In the menu, select "Adapters"

f) In the newly created popup, select the task "Remove resource from this partition"

g) Select the appropriate adapter from the list (only desired one will appear)

h) Select the "OK" button

i) You should have a popup window which tells you if it was successful.

Example:


lsslot -c slot; rmdev -l pci14 -d -R

How to recover a failed MPIO paths from an IBM VIO server on an AIX LPAR

If you have set up disks from 2 VIO servers using MPIO to an AIX LPAR, then you need to make some changes to your hdisks.

You must make sure the hcheck_interval and hcheck_mode are set correctly:

Example for default hdisk0 settings:

# lsattr -El hdisk0
PCM PCM/friend/vscsi Path Control Module False
algorithm fail_over Algorithm True
hcheck_cmd test_unit_rdy Health Check Command True
hcheck_interval 0 Health Check Interval True
hcheck_mode nonactive Health Check Mode True
max_transfer 0x40000 Maximum TRANSFER Size True
pvid 00cd1e7cb226343b0000000000000000 Physical volume identifier False
queue_depth 3 Queue DEPTH True
reserve_policy no_reserve Reserve Policy True


IBM recommends a value of 60 for check_interval and hcheck_mode should be set to "nonactive".

To change these values (if necessary):

# chdev -l hdisk0 -a hcheck_interval=60 -P

# chdev -l hdisk0 -a hcheck_mode=nonactive -P

Now, you would need to reboot for automatic path recovery to take effect.

If you did not set the check_interval and hcheck_mode as described above or did not reboot, then after a failed path, you would see the following even after the path is back online:

# lspath
Enabled hdisk0 vscsi0
Failed hdisk0 vscsi1


To fix this, you would need to execute the following commands:

# chpath -l hdisk0 -p vscsi1 -s disable

# chpath -l hdisk0 -p vscsi1 -s enable

Now, check the status again:

# lspath
Enabled hdisk0 vscsi0
Enabled hdisk0 vscsi1
Example:

chpath -l hdisk0 -p vscsi1 -s disable; chpath -l hdisk0 -p vscsi1 -s enable

How to mount an ISO file as a filesystem in AIX

In AIX you "dd" the ISO file into a raw LV, then mount the LV as a filesystem.

Here are the steps for copying the ISO named "image.iso" into "/cd1iso", a JFS filesystem:

1. Create a filesystem with size slightly bigger than the size of the ISO image. Do NOT mount the filesystem:
# /usr/sbin/crfs -v jfs -g rootvg -a size=800M -m/cd1iso -Ano -pro -tno -a frag=4096 -a nbpi=4096 -a ag=8

2. Get the logical volume name associated with the new filesystem:
# lsfs | grep cd1iso (assume it is /dev/lv00)

3. dd the ISO image into rlv00 (raw lv00):
# dd if=image.iso of=/dev/rlv00 bs=10M

4. Alter /cd1iso stanza in /etc/filesystems => vfs=cdrfs and options=ro (read-only)

/cd1iso:
dev = /dev/cd1_lv
vfs = cdrfs
log = /dev/loglv00
mount = false
options = ro
account = false

5. Mount the file system :
# mount /cd1iso

6. When finished, remove the filesystem:
# rmfs /cd1iso

Example:

/usr/sbin/crfs -v jfs -g rootvg -a size=800M ...

How to mount a cd manually in AIX

To manually mount a cd in IBM AIX:

# mount -V cdrfs -o ro /dev/cd0 /cdrom

Example:


mount -V cdrfs -o ro /dev/cd0 /cdrom

How to find the world-wide name (WWN) of a fibre-channel card in IBM AIX

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"

Example:


lscfg -vp -l fcs0 | grep "Network Address"

How to find what level your IBM VIO Server is running at

To determine which level of Virtual I/O Server (VIOS) you're running:

1) Login in to the VIO partition using the user "padmin"

2) Issue the ioslevel command:

# ioslevel

Example:


# ioslevel

How to find the values for asynchronous i/o in IBM AIX

To find the values for asynchronous I/O in IBM AIX:

# lsattr -El aio0

Example:


lsattr -El aio0

How to find the number of asynchronous i/o servers running in IBM AIX

To find the number of asynchronous i/o servers running in IBM AIX:

To determine you how many Posix AIO Servers (aios) are currently running, as root:

# pstat -a | grep -c posix_aioserver

To determine you how many Legacy AIO Servers (aios) are currently running, as root:

# pstat -a | grep -c aioserver

Example:


pstat -a | grep -c aioserver

How to find the maximum supported logical track group (LTG) size of a disk in AIX

To find the maximum supported logical track group (LTG) size of a disk in IBM AIX, you can use the lquerypv command with the -M flag. The output gives the LTG size in KB.

# /usr/sbin/lquerypv -M hdisk#



Example:

/usr/sbin/lquerypv -M hdisk0

How to find all the rpm packages installed on a particular date

To find all the RPM packages which were installed on a particular date:

# rpm -qa --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH}) INSTALLED: %{INSTALLTIME:date}\n" | grep my_date

Example:


rpm -qa --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH}) INSTALLED: %{INSTALLTIME:date}\n" | grep "29 Sep 2006"

To find the install date and time of an RPM package:

# rpm -qa --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH}) INSTALLED: %{INSTALLTIME:date}\n" | grep rpm_package_name

If you want the epoch time rather than human readable date:

# rpm -qa --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH}) INSTALLED: %{INSTALLTIME}\n" | grep rpm_package_name

Example:

rpm -qa --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH}) INSTALLED: %{INSTALLTIME:date}\n" | grep libaio

How to enable full core dumps in IBM AIX

To enable full core dumps in IBM AIX:

# chdev -l sys0 -a fullcore='true'

Example:

chdev -l sys0 -a fullcore='true'

How to extract an individual file from an AIX mksysb on tape

To extract an individual file from a mksysb on tape:

# restore -s4 -xqvf /dev/rmt0.1 /my/filename

Example:

restore -s4 -xqvf /dev/rmt0.1 ./etc/passwd

How to enable extended netstat statistics in IBM AIX

To enable extended netstat statistics in IBM AIX :

# /usr/sbin/no -o extendednetstats=1

To disable extended netstat statistics in IBM AIX (default in AIX):

# /usr/sbin/no -o extendednetstats=0

Note: you must reboot to take effect.

Example:


/usr/sbin/no -o extendednetstats=1

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

how to enable automatic notification of hardware errors in IBM AIX 5L

AIX 5L can email you when it detects a hardware error. To configure email notification, use the "diag" command.

# diag
=> Task Selection
=> Automatic Error Log Analysis and Notification
=> Add to the error notification mailing list
Example:

diag

how to determine which MPIO path is associated to a vscsi adapter in AIX 5L

To determine which MPIO path is associated to a vscsi adapter in AIX 5L:

# lspath -F "name path_id parent connection status"

The output returns something similar to:

hdisk0 0 vscsi0 810000000000 Enabled
hdisk0 1 vscsi1 810000000000 Enabled
hdisk1 0 vscsi0 820000000000 Enabled
hdisk1 1 vscsi1 820000000000 Enabled

The first field is the hdisk.
The second field is the "Path" number (seen with 'lspath')
The third field is the parent (vscsi adapter)
The fourth field is the connection
The fifth field is the status (Enabled, Disabled, Missing, etc)

Example:


lspath -F "name path_id parent connection status"

how to determine which eFixes are installed on your VIO Server

To determine which emergency fixes are installed on your Virtual I/O Server (VIOS):

1) Login to the VIO server as the user padmin

2) Setup your environment by issuing:

$ oem_setup_env

3) List installed efixes by label:

# emgr -P

4) To remove a specific efix by label (IY71303 in my example):

# emgr -r -L IY71303

5) Go back to the padmin restricted shell

# exit

Example:


emgr -P

how to determine which application created the OS core file in AIX

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.

Example:


/usr/sbin/lquerypv -h /tmp/core 6b0 64

how to disable a single path through one HBA to a disk in IBM AIX

This disables a single path through one HBA to a disk in IBM AIX. This instructs the system to start using an alternative path to the disk.

# chpath -l hdisk# -p fscsi# -s disable

Example:


chpath -l hdisk# -p fscsi# -s disable

how to display the process hierarchy / tree in AIX 5.3

New in AIX 5.3, to display the hierarchy of a process:

# ps -T 1
PID TTY TIME CMD
1 - 0:00 init
4258 - 0:00 |\--errdemon
4728 - 0:00 |\--hdlm_log_push_process
5458 - 0:00 |\--hdlm_link_proc
6488 - 0:00 |\--aioserver
7300 - 0:02 |\--syncd
8092 - 0:00 |\--httpd
9912 - 0:00 ;| |\--httpd
13458 - 0:00 ;| |\--httpd
17580 - 0:00 ;| |\--httpd
17828 - 0:00 ;| |\--httpd
20642 - 0:00 ;| \--httpd
8514 - 0:00 |\--shlap
9496 - 0:00 |\--nfsd
11206 - 0:00 |\--random
12984 - 0:00 |\--rpc.lockd
13220 - 0:00 |\--srcmstr
6904 - 0:00 ;| |\--portmap
7562 - 0:00 ;| |\--sendmail
10404 - 0:00 ;| |\--IBM.LPRMd
Example:

ps -T 1

how to determine / disable 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

Example:


smtctl

How to disable simultaneous multi-threading (SMT) in AIX:

Your system is capable of SMT if it's a POWER5-based system running AIX 5L Version 5.3.

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.

Example:


smtctl -m off

how to detach a network device and update the ODM in IBM AIX

If "ifconfig" is used to detach a network device, the ODM is NOT updated and when the system is rebooted, the adapter will try and bring up its network interface because that is what the ODM instructs it to do.

To detach a network device and update the ODM, the following command needs to be used:

# chdev -l en0 -a state='detach'

This will detach the network device even across reboots.

Example:


chdev -l en0 -a state='detach'

how to clone (make a copy of ) the rootvg in AIX

To clone rootvg in IBM AIX, you can run the alt_disk_copy command to copy the current rootvg to an alternate disk.

The following example shows how to clone the rootvg to hdisk1.

# alt_disk_copy -d hdisk1


Example:

# alt_disk_copy -d hdisk1

how to check if any mksysb resources are allocated for use in IBM AIX

To see if any mksysb resources are allocated for use, the following command can be run:

# lsnim -a mksysb

With a remote hostname of "darkstar" and a mksysb resource with the name "darkstar_mksysb", the output will be similar to this:
# lsnim -a mksysb
darkstar:
mksysb = darkstart_mksysb

Example:


lsnim -a mksysb

how to change the reserve_policy so that multiple IBM VIO servers can access the same disk

In a p5 environment, for disk redundancy through two VIO servers, the default reserve policy on the disk needs to be changed to "no_reserve". This allows multiple VIO servers to see the disk and provide redundancy to LPARs. Here is the command:

# chdev -l hdisk# -a reserve_policy=no_reserve -P

This requires that the disk be removed from the system and brought back in. This can be accomplished with a reboot, or the following commands:

1. unmount and vary off the VG that the disk is part of.
2. rmdev -l hdisk#
3. mkdev -l hdisk#

NOTE: The "-P" makes the change in the ODM. Without it, the command will not work because it tries to update the disk while it is already configured in the sytem and an error will be reported. That is why the removal and restoration of the disk is required.

Example:


chdev -l hdisk3 -a reserve_policy=no_reserve -P

genkld - list of shared objects in AIX

The genkld command extracts the list of shared objects currently loaded onto the
system and displays the address, size, and path name for each object on the
list.

Example:


# genkld

fwtmp - how to manipulate connect-time accounting records

fwtmp manipulates connect-time accounting records by reading binary records in wtmp format from standard input, converting them to formatted ASCII records. The ASCII version is useful when it is necessary to edit bad records.

# fwtmp [-ic]

where :

-ic : denotes that input is in ASCII form, and output is to be written in binary form.

Example to convert a binary record in wtmp format to an ASCII record called dummy.file, enter:

# fwtmp < /var/adm/wtmp > dummy.file

Example to convert an ASCII dummy.file to a binary file in wtmp format called /var/adm/wtmp, enter the fwtmp command with the -ic switch:

# fwtmp -ic <> /var/adm/wtmp

Note: Depending on your flavour of Unix, the file may be called wtmpx or wtmp.

Example:


fwtmp < /var/adm/wtmp > dummy.file

To get a list of all the failed logins in IBM AIX:

To read the file /etc/security/failedlogin, you need to use fwtmp:

# /usr/sbin/acct/fwtmp < /etc/security/failedlogin

To get information for a particular user:

# /usr/sbin/acct/fwtmp < /etc/security/failedlogin | grep username

Example:


/usr/sbin/acct/fwtmp < /etc/security/failedlogin

Commands to find memory utilisation of processes

To find memory usage, try these commands (may vary with version of UNIX):

# svmon -u | more
# svmon -P | more
# ps aux | more
# ipcs -ma | more

Command to find process which uses the most memory in AIX:

# svmon -P -t 1 (aix 4.3.3)
# svmon -Pau 1 (aix 4.3.2)

To find the memory utilisation of a certain proces:

# ps auwww [PID]

PID = process id

Example:


svmon -u ; svmon -P ; ps aux ; ipcs -ma

chvg - notify a VG of the increase of a disk in IBM AIX

To examine all the disks in the volume group to see if they have grown in size in IBM AIX version 5.2 and onward :

# chvg -g

From the man page:

1. The user might be required to execute varyoffvg and then varyonvg on the
volume group for LVM to see the size change on the disks.
2. There is no support for re-sizing while the volume group is activated in
classic or enhanced concurrent mode.
3. There is no support for re-sizing for the rootvg.

Example:

chvg -g datavg1

chhmc - to change the HMC network configuration or to enable and disable remote command execution

The chhmc command is used to change the HMC network configuration or to enable and disable remote command execution:

chhmc -c [network | ssh] -s [enable | disable | add | modify | remove]
[ -i ethØ | eth1 [ -a ip-address ] [ -nm network-mask ]]
[ -d network-domain-name ] [ -h host-name ]
[ -g gateway ] [ -ns DNS-Server ] [ -ds Domain-suffix ]
[ —help ]

where:
• -c – the type of configuration to modify. Valid values are ssh and network.
• -s – the new state value of the configuration. When the configuration type is ssh, the valid values are enable and disable. When the configuration type is network, the valid values are add, modify, and remove. Add and remove are valid only when specifying -ns or -ds.
• -i – the interface to configure. Valid values are eth0 and eth1. This parameter can be used only with -s modify.
• -a – the new network IP address. This parameter can be used only with the -i parameter.
• -nm – the new network mask. This parameter can be used only with the -i parameter.
• -d – the new network domain name. This parameter can be used only with -s modify.
• -h – the new host name. This parameter can be used only with -s modify.
• -g – the new gateway address. This parameter can be used only with -s modify.
• -ns – the DNS server to add or remove. This parameter can be used only with -s add or -s remove.
• -ds – the domain suffix to add or remove. This parameter can be used only with -s add or -s remove.
• -help – prints a help message.

The following are examples of the usage of this command.

To add and remove another domain suffix search other than mycompany.corp:

[hmcusr@hmcproj hmcusr]$ lshmc -n
Network Configuration:
Host Name: hmcproj
TCP/IP Interface Ø Address: 192.168.2.53
TCP/IP Interface Ø Network Mask: 255.255.255.Ø
Default Gateway: 192.168.2.254
Domain Name: mycompany.com
DNS Server Search Order: 192.168.2.6
Domain Suffix Search Order: mycompany.corp

[hmcusr@hmcproj hmcusr]$ chhmc -c network -s remove -ds mycompany.corp

[hmcusr@hmcproj hmcusr]$ lshmc -n
Network Configuration:
Host Name: hmcproj
TCP/IP Interface Ø Address: 192.168.2.53
TCP/IP Interface Ø Network Mask: 255.255.255.Ø
Default Gateway: 192.168.2.254
Domain Name: mycompany.com
DNS Server Search Order: 192.168.2.6
Domain Suffix Search Order:

Example:


chhmc

chpv - how to clear the boot record of a physical volume in IBM AIX

To clear the boot record of a physical volume (disk) in IBM AIX:

# chpv -c hdisk#

Example:


chpv -c hdisk1

chsec - reset the failed login count for a user in IBM AIX

To reset the "unsuccessful_login_count" variable of a user in IBM AIX

# chsec -f /etc/security/lastlog -a "unsuccessful_login_count=0" -s user

Example:


chsec -f /etc/security/lastlog -a "unsuccessful_login_count=0" -s user

chps - how to change your paging space (swap) in IBM AIX

To change your paging space (swap) in IBM AIX:

# chps [ -s LogicalPartitions | -d LogicalPartitions ] [ -a { y | n } ] PagingSpace

where:

-s : specifies the number of logical partitions to add.

-a : specifies to use a paging space at the next system restart. Valid values are "y" or "n".

-d : specifies the number of logical partitions to subtract.

Example to add 16 logical partitions to paging00:

# chps -s'16' paging00

Example to remove 16 logical partitions to paging00:

# chps -d'16' paging00

Example to add 16 logical partitions to paging00 and make the change effective through reboots:

# chps -s'16' paging00 -a'y'

Example:


chps -s'16' paging00 -a'y'

chdev - how to change the media speed of a network interface in IBM AIX

To change the media speed of a network interface in IBM AIX:

# chdev -l 'ent0' -a media_speed='100_Full_Duplex' '-P'

Possible values for media_speed are:

10_Half_Duplex
10_Full_Duplex
100_Half_Duplex
100_Full_Duplex
Auto_Negotiation

Note: The "-P" flag makes this a permament change.

Example:


chdev -l 'ent0' -a media_speed='100_Full_Duplex' '-P'

bootlist - how to view/modify the boot list in IBM AIX

To modify the boot list in IBM AIX:

# bootlist -m normal hdisk# hdisk#

Example:


bootlist -m normal hdisk0 hdisk1

To view the boot list in IBM AIX:

# bootlist -m normal -o

Example:


bootlist -m normal -o

bosboot - make a disk bootable in IBM AIX

To make a disk bootable on the default boot logical volume on the fixed disk from which the system is booted in IBM AIX:

# bosboot -a

To create a bootable image called /tmp/tape.bootimage for a tape device:

# bosboot -ad /dev/rmt0 -b /tmp/tape.bootimage

To create a boot image file for an Ethernet boot:

# bosboot -ad /dev/ent0

Example:


bosboot -a