-
admin posted an update 4 years, 5 months ago
IBM AIX Operating System Quick Cheat sheet
AIX Cheat sheet
sysinfo
AIX
Server Release info
oslevel -r
Server type
prtconf | grep -i ‘System Model’
Hardware Info
lscfg -vlscfg -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
Operating System
oslevel [-r|-s]
Memory
prtconf -mprtconf |grep -i memory
lsattr -El sys0 -a realmem
bootinfo -r
CPU (type, number, etc)
prtconf |grep -i processor
Disk Drives
lsdev -Cc disklsdev -Cc disk -p scsi0 (specific controller)
lsdev -Cc disk -S [a|d|s] (available, defined, stopped)
lscfg -v -l hdisk0
Kernel File and associated directories
/unix/usr/lib/boot
/usr/lib/drivers
Note: /unix – symbolic link to kernel file i.e /usr/lib/boot/unix_64
Kernel 32 or 64
prtconf -kbootinfo -K
Display Firmware
prtconf |grep -i firmwarelscfg -pv
invscout
Display IRQ, IO ports and DMA
prtconf
GUI admin tool
smit
smittyMemory and Swap
Memory
prtconf -mprtconf |grep -i memory
lsattr -El sys0 -a realmem
bootinfo -r
page size (memory)
pagesizepagesize -a (display all supported pagesizes)
display swap
lsps -a (detailed)lsps -s
adding swap
mkps -a -s 4 -n# change the attributes
chps -a n paging00 (don’t use after restart)
# change the logical volume attributes (name in this case)
chlv -n (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
removing swap
swapoff /dev/paging00rmps paging00
Note: paging space must be deactiviated before removing
Disks, Filesystems and Devices
Disk Drives
lsdev -Cc disklsdev -Cc disk -p scsi0 (specific controller)
lsdev -Cc disk -S [a|d|s] (available, defined,stopped)
lscfg -v -l hdisk0
Disk serial Number, type, etc
lscfg -vl hdisk0lscfg -vl hdisk*
Disk disk partitions
lsvg -l rootvglchangelv
cat /etc/filesystems
List Raw Partitions
Just create a new LVOL without a filesystem# create a raw volume
mklv -y rawVolume vg01 10
Bad Blocks
chlv -b [y|n]Note: enables bad block relocation
Filesystem commands
df -klsfs []
lsfs -q (detailed)
Filesystem (create|remove)
crfs -v jfs2 -d data02lv -m /data02 -A yes-v filesystem type
-d device or logical volume
-m mountpoint
-A mount after restart [yes|no]
rmfs -ri /data02
-r remove the mountpoint
-i display warning before removing
chfs -a size=+1G /var (grow by additional 1GB)
chfs -a size=1G /var (grow to 1GB in size)
Tune Filesystems
chfsNote: you can perform the following
resize
freeze
change mountpoint
permissions
lots more…………………………
backup filesystem
backup|restoretar
dd
cpio
Display the boot device
bootinfo -b (display last boot device)bootlist -m [normal|service] -o (display bootable devices)
Setting the boot device
bootlist -m normal hdisk0 hdisk1
Creating boot device (MBR)
bosboot -a (uses default device)bosboot -ad hdisk1
mount/unmount floppy
mount /dev/rfd0 /floppy
mount/unmount CDROM
mount -v cdrfs -r /dev/cd0 /cdromumount /cdrom
create boot disk or recovery tape
mksysb
boot into maintenace mode
1. Restart the machine.2. Wait the the AIX splash screen to come up. Devices begin to initialize here.
3. When you see the [keyboard] word on screen hit the F5 button or the 5 key depending on your console.
4. Choose “select boot options ” when the maintenance screen comes up, then option 1, then option 1 for scsi, then option 3 service mode boot
Device paths
floppy:/dev/fd0
/dev/rfd0
disk:
/dev/hdisk0
cdrom:
/dev/cd0
update /dev directory
cfgmgrcfgmgr -l scsi0
mkdev
remove or change a device
rmdevrmdev -l cd0
chdev
chdev -l rmt0 -a ret=no
list device drivers
lsdevlsdev -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
Basic network information
stores information in the ODM (Object Database Manager)
(hostname, ip address)
displaying network interfaces
ifconfig -aentstat -d
lsdev -Cc if
lsdev -Cc tcpip
odmget -q “name=en0” CuAt
lsattr -EHl en0
Configure network interface
mktcpip (completely setup a 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
-h – hostname assigned to interface
-a – ip address
-m – netmask
-i – interface name
-g – gateway ip address
# remove an interface
ifconfig en1 detach
ifconfig (configures IP address)
chdev (add aliases to network interface)
Starting and stopping a network interface
ifconfig en0 upifconfig en0 down
ifconfig en0 detach (remove)
Setting NIC speed
chdev -l ent0 -a media_speed=1000_Full_Duplex -Pchdev -l ent0 -a media_speed=Auto_Negotiation -P
Note:
entX – physical device
enX – frame type run on entX
Change NIC parameters
netstat -ventstat -d
no -a
no -o “ipforwarding=1”
Display NIC statistics
netstat -i [-f inet]netstat -s
entstat -d
display MAC address
netstat -ia
Displaying network packets
tcpdump -iiptrace -i
ipreport (used with iptrace to view reports)
Note: you must stop the iptrace by using “kill -15”
default router
route add 0Note: there is no file that holds the default router
display routing table
netstat -rnnetstat -r -f inet
lsattr -EHl inet0 -a route
Test IPMP, Bonding
smitty etherchannel (creates, deletes and tests)entstat -d ent0
change the hostname
hostnamechdev -l inet0 -a hostname=
setup DNS
/etc/resolv.conf
Name service switch file (DNS client)
/etc/netsvc.conf/etc/resolv.conf
/etc/irs.conf (may not be there)
chnamsv (change name service)
rmnamsv (remove a name service)
lsnamsv -C (list name services)
Flush DNS cache
netcdctrl -t dns -e hosts -f
Domain Name
domainname
Obtain IP Address routing
route -n get
Find Services on the network
Boot (jumpstart) servers:rpcinfo -b bootparam 1
NFS servers:
rpcinfo -b mountd 1
NIS servers/slaves:
rpcinfo -b ypserv 1
Crash Dump
Crash Dump
sysdumpdev -l (list dump destination)sysdumpdev -e (estimates dumpsize)
sysdumpdev -L (info)
sysdumpstart -p (start dump primary)
sysdumpstart -s (start dump secondary)
# set the dump device permanently
sysdumpdev -p -P
# analyse dump file
echo “stat\n status\n t -m” | crash /var/adm/ras/vmcore.0
Performance Monitoring and Diagnostics
CPU
topas -Ptopas -L (logical partitions)
mpstat
sar -c
w (load average)
uptime (load average)
lparstat
ps
iostat -tT 1
tprof
curt
Memory
topasvmstat
sar -b
svmon
ps
ipcs -a
lockstat (version 4)
rmss
Network
[ent|tok|fddi|atm]statnetstat
netpmon (trcstop to stop trace)
Disk
topas -D (disk)topas -F (filesystem)
iostat
sar -D
fcstat (fibre)
lvmstat
filemon (trcstop to stop)
fileplace
# disk stat history
chdev -l sys0 -a iostat=true
lsattr -HEl sys0 -a iostat
Application
topastruss
sar
probevue
tprof
svmon -P
NFS
nfsstatKernel Modules and Parameters
display loaded modules
genkex
set kernel parameters (tuning)
chdev -l sys0 -a =no -a (network)
vmo -a (virtual memory)
nfso -a (NFS)
ioo -a (Input/Ouput)
raso -a (reliability, availability, serviceability)
schedo -a (processor scheduler)
vi /etc/security/limits
cd /etc/tunables
tunchange, tundefault, tunsave, tunrestore, tuncheck
Note: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjusted
display kernel parameters
lsattr -EHl sys0Note: only a few kernel parameters can be changed
build kernel
chdev -l sys0 -a =Note: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjusted
interprocess communication
ipcs -a
Services
display services
lssrc -a
start services
startsrc -sstartsrc -g
stop services
stopsrc -sstopsrc -g
reload service
refresh -s
restart service
stopsrc -sstartsrc -s
service status
lssrc -a
service logging, etc
/var/adm/ras/etc/syslog.conf
/etc/rc.tcpip
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 (single fileset)
lslpp -w (file belongs)
lslpp -ha (history of filesets)
rpm -qa (all packages)
rpm -q (single package)
rpm -qf (file belongs)
rpm -qi (very detailed)
oslevel -g (install packkages above os level)
whereis
which_fileset
adding package
installp -ainstallp -c (cleanup after failed install)
rpm -i
geninstall (generic installer: installp, RPM, etc)
removing packages
installp -u (commited packages)installp -r (applied packages)
rpm -e
geninstall -u
verify package
lppchk -vrpm -V
List files in package
lslpp -frpm -ql
Package directory
/usr/lpp/var/lib/rpm
List libraries required for binary program
ldd
Accounts
display users
cat /etc/passwdlsuser -f ALL (detailed)
create a user
mkuseruseradd
remove a user
rmuseruserdel
modify a user
chuser -ausermod
passwd -f
passwd -s
chfn
chfn
change user password
passwdpwdadm
pwdck -t ALL
create a group
mkgroup
remove a group
rmgroup
modify a goup
chgroup
password files
/etc/security/passwd
useful user commands
idwhoami
who
w
uptime (displays # of users logged in)
finger
# License information
lslicense
chlicense
# Maximum number of processes for a user
lsattr -D -l sys0 -a maxuproc
chdev -l sys0 -a maxuproc=
useful group commands
groupssetgroups
lsgroup ALL
NFS
NFS Daemons
server: rpc.mountd, nfsdclient: rpc.statd, rpc.lockd
NFS files
/etc/exports/etc/xtab
List nfs clients that have a remote mount
/etc/xtab
display nfs shares
exportfsshowmount -e localhost
create nfs share
mknfsexp -dmknfsmnt
shareall
uncreate nfs share
rmnfsexp -d (unshares and removes from file)exportfs -u
unshareall
start/change nfs daemons
mknfschnfs
startsrc -s nfsd
startsrc -s rpc.mountd
stop nfs daemons
rmnfsstopsrc -s nfsd
stopsrc -s rpc.mountd
nfs status
lssrc -a |grep -i nfs
nfs reload
exportfs -av
nfs performanace
nfsstat
nfs Options
nfso -anfso -o =
exportfs (display options)
NTP
Time daemons
xntpd
ntp setup
/etc/ntp.confstartsrc -s xntpd
stopsrc -s xntpd
lslpp -L all|grep xntpd
ntp daemon options
startsrc -s xntpd -a “-x”/etc/rc.tcpip
NTP Trace commands
ntpq -pntptrace
ntpdate
Log Files
messages
/var/adm/ras
syslog
/var/adm/ras
mail
/usr/spool/mqueue/syslog
cron
/var/adm/cron/log
boot
/var/adm/rasalog -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 (single errorlog report)
errclear (clears errorlog)
errclear -d (clears class errors)
errlogger “message upto 230 chars”
Security
Checking the passwd file
pwdck -t ALLusrck -t ALL
checking the group file
grpck
console login (allow/deny)
# No reboot required/etc/security/user
chsec -f /etc/security/user -s root
Misc
startup
bootlist -m normal hdisk0 hdisk1
shutdown
shutdown -F (fast shutdown)shutdown -Fr (fast shutdown and reboot)
init status0
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 defined7-9 – user defined
# change default – change the initdefault line
vi /etc/inittab
startup scripts
/etc/rc.d/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
Boot process
Phases: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
Base Device Configuration: start configuration manager to configue base devices
System Boot: start init process phase 2, switch to hard-disk root filesystem, start other processes defined by /etc/inittab and execute phase 3 of the /etc/rc.boot script
determine the run level
who -r
obtain default run level
/etc/inittab
list locale
locale -a
initialize system
install_assist
Timezone
/etc/environment/etc/profile
AIX: AIX Cheat SheetAIX, AIX admin, aix lvm, lvm, hmc, lpar, vio, hacmp, hacmp cluster, nim, aix nim, aix virtual optical device, mksysb backup, nim restore, tl upgrade