Friday, October 2, 2009

AIX Quick Command Guild

I found these information on IBM website and posted on my blog for my future references. These commands can become very handy when you need to logon to the AIX box now and then!!

Filesystems
Default rootvg filesystems
hd1 -/home
hd2 -/usr
hd3 -/tmp
hd4 -/
hd5 -Boot logical volume
hd6 -paging space
hd8 -log device
hd9var -/var
hd10opt -/opt
hd11admin -/admin
Remove mount point entry and the LV for /mymount
rmfs /mymount (Add -r to remove mount point)
Grow the /var filesystem by 1 Gig
chfs -a size=+1G /var
Grow the /var filesystem to 1 Gig
chfs -a size=1G /var
Find the file usage on a filesystem
du -smx /
List filesystems in a grep-able format
lsfs
Get extended information about the /home filesystem
lsfs -q /home Create a log device on datavg VG mklv -t jfs2log -y datalog1 datavg 1
Format the log device just created
logform /dev/datalog1

Devices
List all devices on a system
lsdev
Device states are: Undefined; Supported Device, Defined; Not usable (once seen), Available; Usable List all disk devices on a system (Some other devices are: adapter, driver, logical volume, processor)
lsdev -Cc disk
List all customized (existing) device classes (-P for complete list)
lsdev -C -r class
Remove hdisk5
rmdev -dl hdisk5
Get device address of hdisk1 getconf DISK DEVNAME hdisk1 or bootinfo -o hdisk1 Get the size (in MB) of hdisk1 getconf DISK SIZE hdisk1 or bootinfo -s hdisk1 Find the slot of a PCI Ethernet adapter
lsslot -c pci -l ent0
Find the (virtual) location of an Ethernet adapter
lscfg -l ent1
Find the location codes of all devices in the system
lscfg
List all MPIO paths for hdisk0
lspath -l hdisk0
Find the WWN of the fcs0 HBA adapter
lscfg -vl fcs0 grep Network Temporarily change console output to /console.out swcons /console.out (Use swcons to change back.)


Tasks
Change port type of (a 2Gb) HBA (4Gb may use dierent setting)
rmdev -d -l fcnet0
rmdev -d -l fscsi0
chdev -l fcs0 -a link type=pt2pt
cfgmgr
Mirroring rootvg to hdisk1
extendvg rootvg hdisk1
mirrorvg rootvg
bosboot -ad hdisk0
bosboot -ad hdisk1
bootlist -m normal hdisk0 hdisk1


Devices
List all devices on a system
lsdev
Device states are: Undefined; Supported Device, Defined; Not usable (once seen), Available; Usable List all disk devices on a system (Some other devices are: adapter, driver, logical volume, processor)
lsdev -Cc disk
List all customized (existing) device classes (-P for complete list)
lsdev -C -r class
Remove hdisk5
rmdev -dl hdisk5
Get device address of hdisk1 getconf DISK DEVNAME hdisk1 or bootinfo -o hdisk1 Get the size (in MB) of hdisk1 getconf DISK SIZE hdisk1 or bootinfo -s hdisk1 Find the slot of a PCI Ethernet adapter
lsslot -c pci -l ent0
Find the (virtual) location of an Ethernet adapter
lscfg -l ent1
Find the location codes of all devices in the system
lscfg
List all MPIO paths for hdisk0
lspath -l hdisk0
Find the WWN of the fcs0 HBA adapter
lscfg -vl fcs0 grep Network Temporarily change console output to /console.out swcons /console.out (Use swcons to change back.)


Users and Groups
List all settings for root user in grepable format lsuser -f root
List just the user names
lsuser -a id ALL sed ’s/ id.*$//’
Find the fsize value for user wfavorit
lsuser -a fsize wfavorit
Change the fsize value for user wfavorit
chuser fsize=-1 wfavorit


Networking
The examples here assume that the default TCP/IP configuration (rc.net) method is used. If the alternate method of using rc.bsdnet is used then some of these examples may not apply. Determine if rc.bsdnet is used over rc.net lsattr -El inet0 -a bootup option
TCP/IP related daemon startup script
/etc/rc.tcpip
To view the route table
netstat -r
To view the route table from the ODM DB
lsattr -EHl inet0 -a route
Temporarily add a default route
route add default 192.168.1.1
Temporarily add an address to an interface
ifconfig en0 192.168.1.2 netmask 255.255.255.0
Temporarily add an alias to an interface
ifconfig en0 192.168.1.3 netmask 255.255.255.0 alias
To permanently add an IP address to the en1 interface
chdev -l en1 -a netaddr=192.168.1.1 -a netmask=0xffffff00
Permanently add an alias to an interface
chdev -l en0 -a alias4=192.168.1.3,255.255.255.0
Remove a permanently added alias from an interface
chdev -l en0 -a delalias4=192.168.1.3,255.255.255.0
List ODM (next boot) IP configuration for interface
lsattr -El en0
Permanently set the hostname
chdev -l inet0 -a hostname=www.tablesace.net Turn on routing by putting this in rc.net no -o ipforwarding=1
List networking devices
lsdev -Cc tcpip
List Network Interfaces
lsdev -Cc if
List attributes of inet0
lsattr -Ehl inet0
List (physical layer) attributes of ent0
lsattr -El ent0
List (networking layer) attributes of en0
lsattr -El en0
Speed is found through the entX device
lsattr -El ent0 -a media speed
Set the ent0 link to Gig full duplex (Auto Negotiation is another option) chdev -l ent0 -a media speed=1000 Full Duplex -P
Turn off Interface Specific Network Options
no -p -o use isno=0
Get (long) statistics for the ent0 device (no -d is shorter)
entstat -d ent0
List all open, and in use TCP and UDP ports
netstat -anf inet
List all LISTENing TCP ports
netstat -na grep LISTEN
Remove all TCP/IP configuration from a host
rmtcpip IP packets can be captured using iptrace / ipreport or tcpdump


Performance Monitoring
Make topas look like top topas -P
View statistics from other partitions
topas -C
View statistics for disk I/O
topas -D
Show statistics related to micro-partitions in Power5 environment
topas -L
• All of the above commands are availible from within topas
• Use mpstat -d to determine processor affinity on a system. Look for s0 entries for the best affinity and lesser affinity in the higher fields. Get verbose disk stats for hdisk0 every 2 sec

iostat -D hdisk0 2
Get extended vmstat info every 2 seconds
while [ 1 ]; do vmstat -vs; sleep 2; clear; done
Get running CPU stats for system
mpstat 1
Get time based summary totals of network usage by process netpmon to start statistics gathering, trcstop to finish and summarize.


Getting info about the system
Find the version of AIX that is running
oslevel
Find the ML/TL or service pack version oslevel -r –or– oslevel -s List all attributes of system
getconf -a
Find the type of kernel loaded (use -a to get all options)
getconf KERNEL BITMODE
bootinfo and getconf can return much of the same information, getconf returns more and has the grepable -a option. Find the level of firmware on a system
invscout
List all attributes for the kernel “device”
lsattr -El sys0
Print a “dump” of system information
prtconf


smitty FastPaths
Find a smitty FastPath by walking through the smitty screens to get to the screen you wish. Then Hit F8. The dialog will tell you what FastPath will get you to that screen. (F3 closes the dialog.) lvm -LVM Menu mkvg -Screen to create a VG configtcp -TCP/IP Configuration eadap -Ethernet adapter section fcsdd -Fibre Channel adapter section chgsys -Change / Show characteristics of OS users -Manage users (including ulimits) devdrpci -PCI Hot Plug manger etherchannel -EtherChannel / Port Aggregation

No comments:

Post a Comment