Professional Documents
Culture Documents
AIX Cheat Sheet
AIX Cheat Sheet
AIX
oslevel -r
Server Release info
prtconf | grep -i 'System Model'
Server type
lscfg -v
Hardware Info
lscfg -l ent0
lscfg -vl fcs0 (find the WWN of HBA adapter)
lsdev
lsdev -Cc disk
lsdev -Cc disk -p scsi0
lsslot -c [pci|phb|port]
lsslot -c pci -l ent0
lspath -l hdisk0
diag
oslevel [-r|-s]
Operating System
prtconf -m
Memory
prtconf |grep -i memory
lsattr -El sys0 -a realmem
bootinfo -r
prtconf |grep -i processor
CPU (type, number, etc)
lsdev -Cc disk
Disk Drives
lsdev -Cc disk -p scsi0 (specific controller)
lsdev -Cc disk -S [a|d|s] (available, defined, stopped)
lscfg -v -l hdisk0
Kernel File and associated /unix
directories
/usr/lib/boot
/usr/lib/drivers
Note: /unix - symbolic link to kernel file i.e
/usr/lib/boot/unix_64
prtconf -k
Kernel 32 or 64
bootinfo -K
prtconf |grep -i firmware
Display Firmware
lscfg -pv
invscout
prtconf
Display IRQ, IO ports and DMA
smit
smitty
GUI admin tool
Memory and Swap
prtconf -m
Memory
prtconf |grep -i memory
lsattr -El sys0 -a realmem
bootinfo -r
pagesize
page size (memory)
pagesize -a (display all supported pagesizes)
lsps -a (detailed)
display swap
lsps -s
mkps -a -s 4 -n <volume group>
adding swap
# change the attributes
chps -a n paging00 (don't use after restart)
# change the logical volume attributes (name in this
case)
chlv -n <new name> <old old> (chang page space
name)
Note:
-a reconfigure paging space after restart
-s size of the page space (logical partitions)
-n activiates the paging space (use swapoff to
deactivate)
also see /etc/swapspaces file
swapoff /dev/paging00
removing swap
rmps paging00
Note: paging space must be deactiviated before
removing
floppy:
Device paths
/dev/fd0
/dev/rfd0
disk:
/dev/hdisk0
cdrom:
/dev/cd0
cfgmgr
update /dev directory
cfgmgr -l scsi0
mkdev
rmdev
remove or change a device
rmdev -l cd0
chdev
chdev -l rmt0 -a ret=no
lsdev
list device drivers
lsdev -Cc disk
lsdev -Cc disk -p scsi0
lsslot -c pci -l ent0
lscfg
lscfg -l ent0
lscfg -vl fcs0 (find the WWN of HBA adapter)
lspath -l hdisk0
getconf DISK_SIZE hdisk1 (detailed)
Networking
stores information in the ODM (Object Database
Basic network information Manager)
(hostname, ip address)
ifconfig -a
displaying network interfaces
entstat -d <interface>
lsdev -Cc if
lsdev -Cc tcpip
odmget -q "name=en0" CuAt
lsattr -EHl en0
mktcpip (completely setup a network interface)
Configure network interface
rmtcpip (remove all network interfaces)
# configure an interface
mktcpip -h aix1 -a 192.168.1.200 -m 255.255.255.0 -i
en1 -g 192.168.0.10
Crash Dump
sysdumpdev -l (list dump destination)
Crash Dump
sysdumpdev -e (estimates dumpsize)
sysdumpdev -L (info)
sysdumpstart -p (start dump primary)
sysdumpstart -s (start dump secondary)
# set the dump device permanently
sysdumpdev -p <dump device> -P
# analyse dump file
echo "stat\n status\n t -m" | crash
/var/adm/ras/vmcore.0
Services
lssrc -a
display services
startsrc -s <subsystem>
start services
startsrc -g <group>
stopsrc -s <subsystem>
stop services
stopsrc -g <group>
refresh -s <subsystem>
reload service
stopsrc -s <subsystem>
restart service
startsrc -s <subsystem>
lssrc -a
service status
/var/adm/ras
service logging, etc
/etc/syslog.conf
/etc/rc.tcpip
Patching / Software
instfix -ia
display installed patches
instfix -k
adding patch
installp -r
removing patch
lslpp -L all (all filesets)
display installed packages
lslpp -L <package> (single fileset)
lslpp -w <file> (file belongs)
lslpp -ha (history of filesets)
rpm -qa (all packages)
rpm -q (single package)
rpm -qf (file belongs)
rpm -qi <package> (very detailed)
oslevel -g (install packkages above os level)
whereis <filename>
which_fileset <filename>
installp -a
adding package
installp -c (cleanup after failed install)
rpm -i
geninstall (generic installer: installp, RPM, etc)
installp -u (commited packages)
removing packages
installp -r (applied packages)
rpm -e <package>
geninstall -u <package>
lppchk -v
verify package
rpm -V <package>
lslpp -f <fileset>
List files in package
rpm -ql <package>
/usr/lpp
Package directory
/var/lib/rpm
List libraries required for binary ldd <file>
program
Accounts
cat /etc/passwd
display users
lsuser -f ALL (detailed)
NFS
server: rpc.mountd, nfsd
NFS Daemons
client: rpc.statd, rpc.lockd
/etc/exports
NFS files
/etc/xtab
Log Files
messages /var/adm/ras
syslog /var/adm/ras
mail /usr/spool/mqueue/syslog
cron /var/adm/cron/log
boot /var/adm/ras
alog -o -t boot
alog -o -t console
alog -L (list all the logs available)
Error logging /usr/lib/errdemon -l (display attributes)
/usr/lib/errdemon (start error logging)
/usr/lib/errstop (stop error logging)
# use with above errorlog file
errpt (summary errorlog report)
errpt -a (detailed errorlog report)
errpt -j <identifier> (single errorlog report)
errclear (clears errorlog)
errclear -d <class><days> (clears class errors)
errlogger "message upto 230 chars"
Security
Checking the passwd file pwdck -t ALL
usrck -t ALL
checking the group file grpck
# No reboot required
console login (allow/deny)
/etc/security/user
chsec -f /etc/security/user -s root
Misc
bootlist -m normal hdisk0 hdisk1
startup
shutdown -F (fast shutdown)
shutdown
shutdown -Fr (fast shutdown and reboot)
init status
0 0 - reserved
1 1 - reserved
2 2 - multiuser mode with NFS
3 3 - user defined
4 4 - user defined
5 5 - user defined
6 6 - user defined
7-9 - user defined
# change default - change the initdefault line
vi /etc/inittab
/etc/rc.d
startup scripts
/etc/rc.d/init.d
/etc/rc.d/rc2.d - rc9.d
/etc/rc.* (config files for auto-starting)
also uses the System Resource Controller
Phases:
Boot process
Read Only Storage (ROS): check the system board,
perform POST, locate and load boot image, begin
system initialization and execute phase 1 of the
/etc/rc.boot script
who -r
determine the run level
/etc/inittab
obtain default run level
locale -a
list locale
install_assist
initialize system
/etc/environment
Timezone
/etc/profile
LOGICAL PARITITION (LP) One or more PPs. LP represents a mirrored copy of a PP. Up to two copies of a PP can be mirror
in a LP count of three (2 mirrors plus original).
Volume Group Descriptor Area(VGDA) Information about all the LVs and PVs within a VG. The first 64K of a PV is reserved for this ar
in <sys/bootrecord.h>.
The VGDA consists of
BOOTRECORD: - first 512 bytes. Allows the Read Only System (ROS) to boot system
BAD BLK DIRECTORY - found in <sys/bddir.h>
LVM RECORD - found in <lvmrec.h>
Volume Group Status Area(VGSA) Information about which PPs that are stale and which PVs are missing within a VG. The LVM a
driver reserves somewhere between 7-10% of the available disk space for LVM maps, etc.
Physical Volume ID (PVID) The PVID is an amalgamation of the machine’s serial number (from the systems EPROMs) and
that the PVID is being generated. This combination insures theextremely low chance of two disk
created with the same PVID. Finally, when a system is booted, the disk configurator goes and loo
PVID sitting on each disk platter and then compares that to an entry in ODM. If the entry is foun
disk is given the hdiskX name that is associated with the ODM entry for the PVID.
Quorum Quorum is a sort of “sanity” check that LVM uses to resolve possible data confliction and preven
corruption. Quorum
is a method by which 51% or more quorum votes must be available to a volume group before LV
can continue.
Quorum is issued to a disk in a volume group according to how the disk was created within the v
group. When a
volume group consists of one disk, there are two VGDA’s on that disk. Thus, this single disk vol
has a quorum
vote of 2. When another disk is added to the volume group with an “extendvg”, then this new dis
VGDA, but the
original, first disk still retains the two VGDA’s. When the volume group has been extended to th
the third disk
gets the spare VGDA sitting on the first disk and then each disk has a quorum vote of 1. Every d
third disk is
automatically given one VGDA, and thus one vote.
Volume Group ID (VGID) Just as the PVID is a soft serial number for a disk, the VGID is the soft serial number for the vol
It is this serial
number, not the volume group’s ascii name, which all low level LVM commands reference. Add
is the basis for
the LVIDs created on that VGID.
Logical Volume Control Block (LVCB) The logical volume control block (lvcb) consists of the first 512 bytes of a logical volume. This a
important
information such as the creation date of the logical volume, information about mirrored copies, a
mount points
in a journaled filesystem.
Logical Volume ID (LVID) The LVID is the soft serial number used to represent the logical volume to the LVM libraries and
commands. The
LVID is created from the VGID of the volume group, a decimal point, and a number which repre
order which the
logical volume was created on the volume group.
diag -> function select -> task selection -> hot plug task -> scsi and scsi raid hot plug manager ->
replace/remove a device attached to an scsi hot swap enclosure device -> select disk and follow i
## configure new disk an check the new number (hopefully the same)
cfgmgr -v
lsdev -Cc <pv>
## add back to volume group
extendvg <vg> <pv>
## create mirror (two ways to do this)
mklvcopy <lv> 2 <pv>
mirrorvg <lv>
## sync mirror
syncvg -l <lv>
## If this is the rootvg there are additonal steps to take
bosboot -ad /dev/<pv>
bootlist -m normal <pv> <pv>
bootlist -m normal -o
## This procedure places back a mirror disk that you have accidently pulled or that a SAN LUN
disappeared off the network
Accidently remove a mirrored disk or SAN
LUN disappeared off the network ## and its states is classed as "missing"
## see that the disk is in a missing state (see PV state column), also see stale volumes
lsvg -p <vg>
lsvg -M <vg>
## To make the disk active again we use the varyonvg command
varyonvg <vg>
## see that the disk is in a active state (see PV state column)
lsvg -p <vg>
## Now re-sync the volumes in that volume group
syncvg -v <vg>
## Make sure that no volumes are stale
lsvg -M <vg>
## Determine if the ODM and VGDA are correct (in sync)
getlvodm -u <vg>
+block size – We can mention the size using blocks (2048 blocks = 1MB)
+32m – We can mention the size using MB
+4g – We can mention the size using GB
.Mirroring concept?
Check disk size belong to vg , take two same size disk to mirror
# bootinfo –s hdisk2
#lsvg –p rootvg
Add one more disk of same size of already have disk having rootvg.
# extendvg rootvg hdisk2
# lsvg –p rootvg
Now mirror vg with background sync LV. It sync LVs in background with new LVs
# mirrorvg –s rootvg
Sync the disc
#syncvg -v rootvg
Create a boot image
# bosboot –ad /dev/hdisk2
#bosboot –ad /dev/hdisk1
Add a blv
record of newly added disk, first check and then add.
# bootlist –m normal -o
#bootlist –m normal hdisk2 hdisk1
.How do I display all logical volumes that are part of a volume group (e,g, rootvg)?
You can display all logical volumes that are part of rootvg by typing the following command: #lsvg -l
rootvg/
# lsvg -p datavg -- check what disks are associated with datavg Volume Group.
# varyoffvg datavg -- Varyoff datavg VG that needs to be rename
# lspv -- To check VG is off
hdisk0 00ce4c2a9b801046 rootvg active
hdisk1 00ce4c2a9b80cf5f datavg
Now lets export the VG
# exportvg datavg
After exporting look lspv
# lspv
hdisk0 00ce4c2a9b801046 rootvg active
hdisk1 00ce4c2a9b80cf5f None
Now let’s import the VG with new name as shown below -
importvg -y "new name" hdisk#
# importvg -y backupvg hdisk1
# varyonvg backupvg
# mount -a
# df -m /home/nmon
Filesystem MB blocks Free %Used Iused %Iused Mounted on
/dev/nmonlv 256.00 254.73 1% 23 1% /home/nmon
# lsvg -l rootvg | grep nmon
nmonlv jfs2 1 1 1 open/syncd /home/nmon
Change the LV name to nmon_lv.
# chlv -n nmon_lv nmonlv
The df command did not show any change i.e. it still displayed the old LV name. As expected.
# df -m /home/nmon
Filesystem MB blocks Free %Used Iused %Iused Mounted on
/dev/nmonlv 256.00 254.73 1% 23 1% /home/nmon
However, the lsvg command confirmed that the LV name had indeed changed. As did the stanza in /etc/filesystems.
# lsvg -l rootvg | grep nmon
nmon_lv jfs2 1 1 1 open/syncd /home/nmon
After re-mounting the filesystem, the df command now displayed the new LV name.
# umount /home/nmon
# mount /home/nmon
# df /home/nmon
Filesystem 512-blocks Free %Used Iused %Iused Mounted on
/dev/nmon_lv 524288 521696 1% 23 1% /home/nmon
1. Modify the /usr/lib/boot/unix directory and the /unix directory to be a symbolic link to the binary for the
desired kernel.
2. Run the bosboot command to write a new system boot image.
3. Reboot the system.
The path name of the 64-bit kernel is /usr/lib/boot/unix_64, and the
path name of the multiprocessor versions of the 32-bit kernel is
/usr/lib/boot/unix_mp.
# ln -sf /usr/lib/boot/unix_mp /unix
# ln -sf /usr/lib/boot/unix_mp /usr/lib/boot/unix
# lslv -m hd5
# bosboot -ad /dev/ipldevice
# shutdown -Fr
# bootinfo -K (should now be 32)
NFS
NFS Daemons server: rpc.mountd, nfsd
client: rpc.statd, rpc.lockd
NFS files /etc/exports
/etc/xtab
List nfs clients that
have a remote mount /etc/xtab
Display nfs shares Exportfs
showmount -e localhost
Create nfs share mknfsexp -d <directory>
Mknfsmnt
Shareall
uncreate nfs share rmnfsexp -d <directory> (unshares and removes from file)
exportfs -u <filesystem>
Unshareall
start/change nfs
daemons Mknfs
chnfs
startsrc -s nfsd
startsrc -s rpc.mountd
stop nfs daemons Rmnfs
stopsrc -s nfsd
stopsrc -s rpc.mountd
nfs status lssrc -a |grep -i nfs
# ln –s file1.txt file2.txt
# ls –li
24 -rw-r--r-- 1 root system 19 Apr 02 14:18 file1.txt
313 lrwxrwxrwx 1 root system 9 Apr 02 14:18 file2.txt -> file1.txt
#
# cat > file1.txt
# cat < file2.txt
For Removal,
# rm file1.txt
# cat < file2.txt
There will be no output for the above command.
Log Files
messages /var/adm/ras
syslog /var/adm/ras /etc/syslog.conf
mail /usr/spool/mqueue/syslog
cron /var/adm/cron/log
boot log /var/adm/ras
alog -o -t boot
alog -o -t console
alog -L (list all the logs available)
Error logging /usr/lib/errdemon (error daemon stay)
/usr/lib/errdemon -l (display attributes)
/usr/lib/errdemon (start error logging)
/usr/lib/errstop (stop error logging)
# use with above errorlog file
errpt (summary errorlog report)
errpt -a (detailed errorlog report)
errpt –d H [H/W]
errpt –d S [S/W]
errpt -j <identifier> (single errorlog report)
errclear (cmd to clears errorlog)
errclear -d <class><days> (clears class errors)
errlogger "message upto 230 chars"
/usr/lib/errdemon –s ____ [ size ]
/usr/lib/errdemon -s 41943040 ----Size change to 40m
. How do remove the entries of the device in the odm #rmdev -dl
*User ADD
useradd -d /home/uname -m -g gname -s /usr/bin/ksh uname
*How to unlock user account?
chuser –a account=true username
*How to lock a user’s account?
#chuser account_lock=true username
remove a user rmuser
modify a user chuser -a
usermod
passwd -f
passwd -s
change user password passwd
create a group mkgroup <group name>
remove a group rmgroup <group name>
modify a goup chgroup <attribute><group name>
/etc/passwd Contains the basic attributes of users.
/etc/security/passwd Contains password information.
/etc/group Contains the basic attributes of groups.
/etc/security/group Contains the extended attributes of groups.
/etc/security/environ Contains the environment attributes for users.
/etc/security/lastlog Contains the last login attributes for users.
/etc/utmp Contains a record of users logged into the system.
/var/adm/wtmp Contains connect-time accounting records.
/etc/security/failedlogin Records all failed login attempts.
Patching / Software
display installed patches instfix -ia
adding patch instfix -k
removing patch installp -r
display installed packages lslpp -L all (all filesets)
lslpp -L <package> (single fileset)
lslpp -w <file> (file belongs)
lslpp -ha (history of filesets)
adding package installp -a
installp -c (cleanup after failed install)
removing packages installp -u (commited packages)
installp -r (applied packages)
verify package lppchk -v
List files in package lslpp -f <fileset>
Package directory /usr/lpp
Diagnostics
CPU topas -P
topas -L (logical partitions)
mpstat
sar -c
Memory topas
vmstat
sar -b
svmon
Disk topas -D (disk)
topas -F (filesystem)
iostat
sar -D
Application topas
truss
sar
svmon -P <pid>
#LPAR
$ lsdev -virtual
$ lsdev -slots
$ lsmap -all show in details all virtual device
$ lsmap -vadapter vhost0 ----list specific attrbute of vhost0
$ lsdev -type adapter --- list all adapter
$ mkvdev -sea ent0 -vadapter ent2 -default ent2 -defaultid 42 ---- Creates SEA
In this installation we can change the installation disk (hdisk0, or hdisk1), Desktop options.
This is used for recover the existing OS problems. (Boot image, Boot list, File systems problems).
2.Migration:
In this migration Installation, Operating system Updated from lower level to higher level i.e. Aix 5.1 To Aix 5.3 or Aix 5.2 To
Aix 5.3 ,
NOTE:
In this installation System data will not be affected except the /tmp file system. i.e. /tmp file system will be deleted and newly
created.
3.Preservation:
This installation is overwriting the existing OS and user data directory /home only persevered, rest of the directories /, /var, /tmp,
/etc, /dev, /opt will be deleted and newly created.
NOTE: In this installation we can preserve additional directories also, suppose if you want preserve /opt, this case u should put
/opt file system entry in /etc/preserve.list file.
1. Predefined
In this predefined Database has one Object class (PdDv) and Objects i.e.
PdDv (Object class)
Object: (Physical Information’s)
Floppy drive
Harddisk drive
Mouse like this all the devices.
2. Customized
In this customized Database has one Object class (CuDv) and Objects i.e.
CuDv (Object class)
Objects: (Installed configuration information’s)
hdisk0
hdisk1
fd0
sa0
rmt0
cd0
scsi0 like this all the devices
ODM States:
What is available state and defined state for the device?
ODM has two states
1.Available (device status will be 1)
2.Defined (device status will be 0)
Suppose we are installing one HDD in server. That device is currently accessible this is available state.
Suppose that installed device is removed from server or hdd has failed. This case that device is moved to defined state. i.e. that
device configuration is available in server but currently device is not accessible.
We can see this available and defined device status using odmget command
#odmget CuDv ( It will display the customized device status)
ODM Commands:
For object:
1.odmadd
2.odmchange
3.odmget
4.odmdelete
1. odmadd
The above command is used to manually we can add object information in ODM
2. odmchange
The above command is used to change configurations for object in ODM
3. odmget
# odmget –q name=hdisk0 CuDv
The above command is used to display the specified object hdisk0 information in ODM
We can see this available and defined device status using odmget command
# odmget CuDv (It will display the customized device status)
4. odmdelete
# odmdelete –o CuDv –q name=hdisk0
The above command is used to delete the specified object hdisk0 in ODM.
1. odmcreate
The above command is used to manually we can add object class (PdDv) in ODM
2. odmdrop
The above command is used to stop the specified Object class in ODM
3. odmshow
The above command is used to display the specified object class in ODM
NOTE: You should not add, delete, change, for object and object class in ODM