Friday, June 26, 2015

AIX Cheatsheet

AIX Cheatsheet


SOME GOOD COMMANDS TO BACK UP SYSTEM SETTINGS:
lspv                        Lists physical volumes, PVID, VG membership
lscfg                       Provides information regarding system components
prtconf                 Displays system configuration information
lsvg                        Lists the volume groups
lsps                         Displays information about paging spaces
lsfs                          Gives file system information
lsdev                      Provides device information
getconf                 Displays values of system configuration variables
bootinfo                Displays system configuration information
snap                       Collects system data and creates a dump


USING SUMA (Service Update Management Assistant)
1. To immediately execute a task that will preview downloading any
critical fixes that have become available and are not already
installed on your system:
# suma -x -a RqType=Critical -a Action=Preview
2. To create and schedule a task that will download the latest fixes
monthly (for example, on the 15th of every month at 2:30 AM):
# suma -s "30 2 15 * *" -a RqType=Latest \
-a DisplayName="Critical fixes - 15th Monthly"
Task ID 4 created.
3. To list information about the newly created SUMA task (which has
a Task ID of 4):
# suma -l 4
4. To list the SUMA task defaults, type the following:
# suma –D
DisplayName=
Action=Download
RqType=Security
...
5. To create and schedule a task that will check monthly (for example,
on the 15th of every month at 2:30 AM) for all the latest new
updates, and download any that are not already in the /tmp/latest
repository, type the following:
# suma -s "30 2 15 * *" -a RqType=Latest \
-a DLTarget=/tmp/latest –a FilterDir=/tmp/latest
Task ID 5 created.

CONFIGURING THE ODM
Changing ODM Attribute Values:
# odmget -q"uniquetype=tape/scsi/scsd and attribute=block_size" PdAt > file
# vi file

Modify deflt to 512

# odmdelete -o PdAt -q"uniquetype=tape/scsi/scsd and attribute=block_size"
# odmadd file

odmget -q "name=hdisk0 and attribute=pvid" CuAt                Look for ODM Values EXACTLY in hdisk0
odmget -q "value3 like hdisk[03]" CuDvDr                                Search for similar ODM values in hdisk0 and hdisk3

FIXING ODM ISSUES
If the ODM problem is not in the rootvg, for example in volume
group homevg, do the following:
# varyoffvg homevg
# exportvg homevg
# importvg -y homevg hdiskX

If the ODM problem is in the rootvg, try using
rvgrecover:

FIXING STALE PARTITIONS
If stale partition is on hdisk2:
After repair of hdisk2
varyonvg VGName (calls syncvg -v VGName)

Change Speed/Duplex
entstat -d ent0      OR lsattr -R -l ent0 -a media_speed ChECK SPEED/DUPLEX!!!!
chdev -P -l ent0 -a media_speed=1000_Full_Duplex  SET SPEED/DUPLEX


smitty    This command gains access to the menu driven AIX managenment software.
                Within smit:
                F6           Show commands smit ran to accomplish task
                F8           Take Screenshot
                F9           Break into shell

bootinfo                                With –p switch shows architecture (i.e. chrp) and –y shows kernel bit (32 or 64)

alog                        maintains/manages logs    EX. alog -o -t boot  shows the boot log


cfgmgr                  manages system devices and searches for newly connected hardware

lssrc –g spooler   Lists service group spooler subsystems
startsrc/stopsrc –s lpd       Starts/stops the lpd daemon subsystem
refresh –s lpd      Rereads the lpd daemon configuration

last                                         list login info         EX. last root console
bootlist                                 display/alter boot order      EX. bootlist -m normal hdisk0 cd0

uptime                                  display system uptime
mpcfg                                    display service information               EX. mpcfg -cf 11 1
shutdown  -Fr                      Reboots system correctly

lsdev                      list device info     
                                lsdev –P –H                          List predefined devices
                                lsdev –Pc tape                     List predefined tape devices
                                lsdev –CH                             List name and location of configured devices
                                lscfg –v                                 List details of all devices

lspv                        list physical volume status  EX. lspv –p hdisk0

lsattr                      list device attributes  EX. lsattr -l rmt0 –E
                                lsattr -El sys0

getconf –a            Provides systems configuration variable values
lsfs                          Lists filesystems in the standard fstab/vfstab format
                                This can be compared to /etc/filesystems where the info is pulled from

lsvg –l rootvg      Lists logical volumes in rootvg as well as their states and partition counts
lsvg –o                   Lists varied on volume groups
lsvg –p rootvg     Lists physical volumes and their states and free partitions in rootvg
lsvg -o | lsvg -i –l                 List logical volumes by volume group

/usr/sbin/lquerypv -M hdisk0          Display logical track group size of hdisk0 – default is 128K
                                Can be changed with varyonvg -M <LTGsize>

lslv –l lv00           Show physical volumes map to lv00
                                lslv –m lv00         Shows the physical partition mapping

lqueryvg -p hdisk1 -At                                      Show Volume Group Descriptor Area properties
getlvcb -AT hd2                                                  Show Logical Volume Control Block info
migratepv -l lv02 hdisk0 hdisk6                     Migrate contents of PV hdisk0 to hdisk6

chfs -a size="-16M" /myfs                               Change the size of /myfs (as well as the LV) less 16M
                                                                                +16M would increase it
tcpdump src host 192.168.1.108 and tcp dst port 25 Check all port 25 traffic from from 192.168.1.108

FIX A CORRUPTED BOOT LOGICAL VOLUME:
Boot to Maintenance Mode off of CD
1 Access a Root Volume Group
# bosboot -ad /dev/hdisk0
# shutdown -Fr

WORKING WITH BOOTLISTS
Normal Mode:
# bootlist -m normal hdisk0 hdisk1
# bootlist -m normal -o
hdisk0 blv=hd5
hdisk1 blv=hd5

Service Mode:
# bootlist -m service -o
cd0
hdisk0 blv=hd5
ent0

Diagnostics Mode
-----------------
# diag
TASK SELECTION LIST
Display Service Hints
Display Software Product Data
Display or Change Bootlist
Gather System Information

ACCESSING SMS:
Press F1 or 1 During system boot when the IBM banner and keyboard is displayed



RAM DISKS
mkramdisk 4M                   Make a RAM Disk of 4MB
mkfs -V jfs /dev/ramdisk0                               Create a filesystem on the RAMDISK
mkdir /ramdisk                  Make a mount point
mount -V jfs -o nointegrity /dev/ramdisk0 /ramdisk                                Mount the RAMDISK

DVD RAM
udfcreate -d /dev/cd0                                        Create a UDF file system
udflabel -d /dev/cd0 -l testdvd                         Change the label on a UDF file system
mkdir /dvddisk                                                   Create a mount point
mount -V udfs -o rw /dev/cd0 /dvddisk         Mount a UDF file system
udfcheck -d /dev/cd0 grep :-:                           Check a UDF file system

Files most likely to grow and fill filesytstems:
/var/adm/wtmp
/etc/security/failedlogin
/var/adm/sulog
/var/spool/*/*
$HOME/smit.log
$HOME/smit.script
$HOME/websm.log
$HOME/websm.script

lsps –a                   Check paging spaces
                                This should be looked at in a “Cannot fork process” error
cat /etc/swapspaces            Check paging space activated at startup
smit mkps             Smitty fastpath to create a paging space      
                                smit chps allows change to the paging space

Removing Paging Spaces:
swapoff /dev/paging00     Make inactive
rmps paging00                    Remove inactive paging space


Increasing Paging Space Dynamically:
chps -s 1 paging00                                              Increases paging space
Ex.          chps –s #pp’s hd6                                i.e.  chps –s 68 hd6             
chps -d LogicalPartitions PagingSpace       Decreases paging space

lsattr -El sys0 -a realmem                                Show total Memory

smit sysbackup                    Start mksysb process from smit to backup rootvg
                                                Set expand /tmp to yes
                                                Set Backup device to file to rmt0 or filename
                                                smit mkcd             Backs system to CD
                                                smit mkdvd          Backs system to DVD
smit vgbackup                     Back up volume groups other than rootvg with the savevg command
                                                smit restvg           Restores this image
                                                smit savevgcd or smit savevgdvd   Saves image to CD or DVD

Using the backup command:
Example 1: Read input from a file
cat listfile
/home/roy/file1
/home/roy/file2
/home/roy/file3
backup -iqvf /dev/rmt0 < listfile

Example 2: Use find to generate list
find /home/roy | backup -iqvf /dev/rmt0
cd /home/roy
find . | backup -iqvf /dev/rmt0

Example 3: Backup by inode
backup -u -1 -f /dev/rmt0 /home

Using the Restore Command
restore -Tvf /dev/rmt0                                                      List files on media (verify the backup)
restore -xvf /dev/rmt0/home/mike/manual/chap1    Restore individual files
restore -rqvf /dev/rmt0                                                    Restore complete file system

Restoring files permissions without file contents:
To restore only the permissions of the file /etc/passwd from
the archive:
restore -Pa -vf /dev/rmt0 ./etc/passwd
To display only the permissions of the file /etc/passwd on the
archive:
restore -Ta -vf /dev/rmt0 ./etc/passwd

Using tar
tar -cvf /dev/rmt0.3 /home                                              Generate a tar backup
tar -xvf /dev/rmt0 /home/team01/mydir                     Restore a file from a tar image
tar -tvf /dev/rmt0                                                               List (verify) content of a tar file

Using cpio
find /home | cpio -ov> /dev/rmt0                    Generate a cpio backup
cpio -idv </dev/rmt0                                          Restore from a cpio image
cpio -itv < /dev/rmt0                                          List (verify) the contents of a cpio image

Using dd
dd if=/etc/inittab of=/dev/rfd0                                        To copy a file to diskette
dd if=text.ascii of=text.ebcdic conv=ebcdic To convert a file from ASCII to EBCDIC
cat lcase.data | dd conv=ucase                                        To convert data to uppercase characters


Tape Control
tctl {
rewind Rewinds a tape
fsf Fast forwards a tape
offline Ejects a tape
rewoffl Rewinds and ejects a tape }

tctl -f /dev/rmt0 rewind
tctl -f /dev/rmt0.1 fsf 3
tctl -f /dev/rmt0 rewoffl
restore -s 4 -xvf /dev/rmt0.1 ./etc/inittab

swrole SysBoot                   Create subshell with role in effect (RBAC)

LOGIN environment processing:
/etc/environment
/etc/profile
$HOME/.profile
$HOME/.kshrc


User/Group Administration via SMIT:
smit security
smit users
smit mkuser
smit chuser
smit groups
smit mkgroup
smit chgroup

lsuser –a id home ALL                     List users and certain attributes (id and home)
rmuser –p team01              removes user
rm -r /home/team01          removes their home directory
lsgroup ALL                        Lists all groups
passwd username or pwadm username                        Administers passwords for user

/etc/motd                              A message of the day to display to the user during login
                                                Can be suppressed with $HOME/.hushlogin file


Access Control Lists – used to specify specific permissions for files to users:
aclget file1            Display base/extended permissions
aclget status99 | aclput report99      Copy ACL's
acledit salaries2   Specify ACL's
Example:
acledit salaries
               
base permissions
...
extended permissions
enabled
permit r– u:simon


acledit status99

attributes:
base permissions
owner(fred): rwx
group(finance): rwothers:
---
extended permissions
enabled
permit --x u:michael
specify r-- u:anne,g:account
specify r-- u:nadine

michael (member of group finance) gets read, write (base)
and execute (extended) permission
• If anne is in group account, she gets read permission on file
status99
• nadine (member of group finance) gets only read access

acledit report99

attributes:
base permissions
owner (sarah): rwx
group (mail): r--
others: r--
extended permissions
enabled
deny r-- u:paul g:mail
deny r-- g:gateway

deny: Restricts the user or group from using the specified
access to the file
• deny overrules permit and specify



Files used to contain user attributes and control access:
– /etc/passwd                       Valid users (not passwords)
– /etc/group                         Valid groups
– /etc/security                      Directory not accessible to normal users
– /etc/security/passwd       User passwords
– /etc/security/user            Group attributes
– /etc/security/limits          User limits
– /etc/security/environ      User environment settings
– /etc/security/login.cfg    Login settings

Validating the user environment
pwdck verifies the validity of local authentication information:
– pwdck {-n|-p|-t|-y} {ALL | username}
– Verifies that /etc/passwd and /etc/security/passwd are consistent with each other and with /etc/security/login.cfg and /etc/security/user
usrck verifies the validity of a user definition:
– usrck {-l|-b|-n|-p|-t|-y} {ALL | username}
– Checks each user name in /etc/passwd, /etc/security/user,/etc/security/limits and /etc/security/passwd
– Checks are made to ensure that each has an entry in /etc/group and /etc/security/group
grpck verifies the validity of a group:
– grpck {-n|-p|-t|-y} {ALL | groupname }
– Verifies that the files /etc/passwd, /etc/security/user, /etc/group and /etc/security/group are consistent


SCHEDULING JOBS
crontab -l                                              List scheduled tasks
#0 3 * * * /usr/sbin/skulker
minute hour date-of-month month day-of-week command
                                                                crontab -e             Edit scheduled tasks

The at command submits a uniquely occurring job to be run by cron at a specified time:
at now +2 mins
banner hello > /dev/pts/0
<ctrl-d>
job user.time.a will be run at date

The batch command submits a job to be run when the processor load is sufficiently low:
 batch
banner hello > /dev/pts/0
<ctrl-d>


PRINTING
********************************************************
smit spooler                                         Adds printer queues and associates with devices (usually local)
smit mkhostslpd                                  Adds authorization for a remote lpd client
smit mkitab_lpd                                 Start LPD
smit chpq                                              Change print queue characteristics
smit rmpq                                             Remove queue
smit pqmanage                                   Manage print queue
smit jobs                                               Manage print jobs
smit qcan                                              Cancel job
cat file > /dev/lp0                               Submit a print job via a file
lpstat                                                      Check queue status
                                                                To enable a queue whose status is DOWN:
enable draft
To disable a queue whose status is READY:
disable qualitympq

System files associated with printing
/etc/qconfig Queue configuration files
/var/spool/* Spooling directories
/var/spool/lpd/qdir/* Queue requests
/var/spool/qdaemon/* Temporary enqueued files
/var/spool/lpd/stat/* Line printer status information
/var/spool/lpd/pio/@local Virtual printer directories

To submit a job to a queue:
System V BSD AIX
lp lpr qprt
$ lp -d queuename filename
- OR-
$ qprt -P queuename filename

To list jobs in a queue:
SYSTEM V BSD AIX
lpstat lpq qchk
For example:
$ qchk
Queue Dev Status Job Files User PP % Blks Cp Rnk
ps lp0 DOWN
QUEUE 569 /etc/motd root 1 1 1


SYSTEM V:
Create a printer:
lpadmin -p myprinter -v /dev/lp01 -c bldg5 -T PS \
-I postscript -m PS

Printer types
terminfo source for printers:
/usr/share/lib/terminfo/svprint.ti
Compiled terminfo file for a Canon Bubble Jet (printer type bj-300):
/usr/share/lib/terminfo/b/bj-300
To compile terminfo source:
# tic svprint.ti
To view bj-300 terminfo entry:
# infocmp bj-300 Print server

Spool/Log files:
Ex. cd /var/spool/lp/tmp/kca48

Start printing:
enable printer
Stop printing:
disable [-c] [-r reason] [-W] printer
Start queuing:
accept printer
Stop queuing:
reject [-r reason] printer
Creating and enabling a new printer:
– mkdev
– lpadmin
– accept
– enable

Using the print service
Submit print jobs:
– # lp -d dest [print-options] file_list
Modify print jobs:
– # lp -i request-id [print-options]
Cancel print jobs:
– # cancel request-id-list
– # cancel printer
– # cancel -u user-list [printer-list]
Check status:
– # lpstat [flags] [object-list]
********************************************************

smit web_configure                           Configure IBM Webserver
                                                                Set default browser to netscape
wsm                                                        Access AIX web-based system manager

Configuring the client/server Web-based System Manager
Install the Web server
Test the Web server
Install the Web-based System Manager (usually done by default with the base)
Define the Web server document directory
/usr/websm/bin/wsmappletcfg -docdir directory
Enable the Web-based System Manager server
/usr/websm/bin/wsmserver -enable

entstat –d en0                                      Check speed/duplex/link of an adapter


SERIAL CONSOLES
Enable login attribute:
login=disable Available for dial-out line
login=enable Login prompt on terminal
login=delay User must press key first
login=share Bi-directional port
Use SMIT or chdev for permanent change

smit tty                                  Set TTY Attributes

penable/pdisable
penable [-a] [device_name]              To enable terminals
pdisable [-a] [device_name]             To disable terminals, run the pdisable command:
penable and pdisable by themselves, list all the terminals enabled or disabled respectively.  Only the console cannot be disabled in this manner

PORT MIRROR
Command to mirror SSH sessions AIX:
who am i                               Checks session number for the user
portmir -t pts/1 -m pts/3
To turn off:
portmir -o

TTY problems
Incorrect terminal type/settings:
– Change attributes (SMIT)
– Terminal setup menu
– TERM variable/terminfo database
Hung terminal (crashed program or cat binary file):
– From terminal:
Try start key <ctrl-q>
Reset terminal from setup menu
Try interrupt, quit keys
<ctrl-j> stty sane <ctrl-j> then log off/on again
– From another terminal:
stty -a < /dev/ttyn
Then, stty sane </dev/ttyn
or
kill -9 pid_of_login_shell


acledit filename                                  Sets extended file permission attributes
                                                                EX.         permit r-x  u:sarah
                                                                                deny rwx u: bob
                                                                can be checked with aclget filename



/usr/lib/errdemon –l  ---- DETERMINE PATH TO ERROR LOG

errpt – give detailed error listings                EX. errpt –a
errpt [ -a ] [ -c ] [ -d ErrorClassList ] [ -e EndDate ] [ -g ] [ -i File ] [ -j ErrorID [ ,ErrorID ] ] | [ -k ErrorID [ ,ErrorID ]] [ -J ErrorLabel [,ErrorLabel ]]|[-KErrorLabel [ ,ErrorLabel ]][-l SequenceNumber ] [-m Machine ] [ -n Node ] [-s StartDate ] [ -F FlagList ] [ -N ResourceNameList ][-RResourceTypeList ] [ -S ResourceClassList ] [ -T ErrorTypeList ] [ -y File ] [ -z File ]

NOTE: CAN BE USED WITH diag, errclear, errinstall, errupdate


syslogd [ -d ] [ -s ] [ -f ConfigurationFile ] [ -m MarkInterval ] [-r]  ---- Turns on syslog daemon and logs to destination determined by /etc/syslog.conf and can be started/stopped using stop(start)src -s syslogd

mkdev -c tty -t tty -s rs232 -p sa0 -w s1 -a login=enable -a term=ibm3151  ---- add 3151 ASCII terminal login which can be removed with rmdev -l <tty name> -d

oslevel [ -l Level | -g | -q ]  --- Check system software levels

installp --- install/commit/reject/remove/apply software        EX’s. installp -aX -d/usr/sys/inst.images bos.net ,  installp -cgX all,  installp -rBpX bos.net,  installp -ugp -V2 bos.net, installp –C,  installp -L -d /dev/cd0

NOTE: Alternately you could use smitty install_latest


SMS Menu                                           

Software and Fix Maintentance
------------------------------------------
lslpp –l                  list available installed system software
                                Alternatively you could use smitty list_installed
instfix -k IY58143 -d /dev/cd0        Installs a fix
instfix -ik IY58143                             Searches for a fix
instfix -s SCSI -d /dev/cd0                Searches for a fix by keyword
instfix -i | grep ML                             Lists which AIX BOS maintenance levels are partly or fully
installed
instfix -ciqk 6100-01_AIX_ML | grep :-:                     Lists which filesets are missing in a partly installed AIX BOS maintenance level

fixdist --- graphical software install tool

inutoc --- rebuild software installation database

instfix [ -T ] [ -s String ] [ -S ] [ -k Keyword | -f File ] [ -p ] [ -d Device ] [ -i [ -c ] [ -q ] [ -t Type ] [ -v ] [ -F ] ] [ -a ]

Check for installed system fixes     EX. instfix –iv 

NOTE:  Alternately you could use smitty show apar_stat


smitty alt_clone --- create alternate rootvg image

smitty alt_mksysb ----  create mksysb image

Object Data Manager ---- stores device classes…..can be manipulated with the following commands: odmadd, odmchange, odmcreate, odmdelete, odmdrop, odmshow, odmget
getlvcb -TA hd2 --- get logical volume control block info

mklvcopy --- make logical volume copy

mirrorvg [ -S | -s ] [ -Q ] [ -c Copies] [ -m ] VolumeGroup [PhysicalVolume .. ] ---- mirror all volumes in a logical volume group
EX.  mirrorvg rootvg


MIRROR ROOTVG

1)            lspv
####List the physical volumes with their respective volume group
r01s6vlp1[ / ]=>lspv
hdisk0          00cd196f027ea5c1                    rootvg          active
hdisk1          00cd196f4ede3b21                    None
r01s6vlp1[ / ]=>

2)            lsvg -l rootvg
####List the logical volumes in rootvg
r01s6vlp1[ / ]=>lsvg -l rootvg
rootvg:
LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT
hd5                 boot       1     1     1    closed/syncd  N/A
hd6                 paging     4     4     1    open/syncd    N/A
hd8                 jfs2log    1     1     1    open/syncd    N/A
hd4                 jfs2       3     3     1    open/syncd    /
hd2                 jfs2       18    18    1    open/syncd    /usr
hd9var              jfs2       1     1     1    open/syncd    /var
hd3                 jfs2       1     1     1    open/syncd    /tmp
hd1                 jfs2       1     1     1    open/syncd    /home
hd10opt             jfs2       1     1     1    open/syncd    /opt
r01s6vlp1[ / ]=>

3)            extendvg -f rootvg hdisk1
####Add the second disk to the rootvg so that there is enough space for a mirror         
r01s6vlp1[ / ]=>extendvg -f rootvg hdisk1
r01s6vlp1[ / ]=>lspv
hdisk0          00cd196f027ea5c1                    rootvg          active
hdisk1          00cd196f4ede3b21                    rootvg          active

3a)          chvg -Qn rootvg                 ####Turn off quorum on rootvg when there is only 1 mirror

4)            mirrorvg -S -c 2 rootvg
####Mirror the entire rootvg
r01s6vlp1[ / ]=>mirrorvg -S -c 2 rootvg
0516-1124 mirrorvg: Quorum requirement turned off, reboot system for this
        to take effect for rootvg.
0516-1126 mirrorvg: rootvg successfully mirrored, user should perform
        bosboot of system to initialize boot records.  Then, user must modify
        bootlist to include:  hdisk0 hdisk1.
####List the logical volumes in rootvg
r01s6vlp1[ / ]=>lsvg -l rootvg
rootvg:
LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT
hd5                 boot       1     2     2    closed/syncd  N/A
hd6                 paging     4     8     2    open/syncd    N/A
hd8                 jfs2log    1     2     2    open/syncd    N/A
hd4                 jfs2       3     6     2    open/syncd    /
hd2                 jfs2       18    36    2    open/stale    /usr
hd9var              jfs2       1     2     2    open/stale    /var
hd3                 jfs2       1     2     2    open/stale    /tmp
hd1                 jfs2       1     2     2    open/stale    /home
hd10opt             jfs2       1     2     2    open/stale    /opt
r01s6vlp1[ / ]=>

####Note now that there are 2 PP's for every LP (2 copies)

5)            bosboot -a
####Initialize boot records
r01s6vlp1[ / ]=>bosboot -a

bosboot: Boot image is 33014 512 byte blocks.

6)            bootlist -m normal -o
####Check bootlist but do not modify
r01s6vlp1[ / ]=>bootlist -m normal -o
hdisk0 blv=hd5

7)            bootlist -m normal -o hdisk0 hdisk1
####Set the bootlist to hdisk0 and hdisk1
r01s6vlp1[ / ]=>bootlist -m normal -o hdisk0 hdisk1
hdisk0 blv=hd5
hdisk1 blv=hd5
r01s6vlp1[ / ]=>

8)            sync;sync;sync;shutdown -Fr now

9)            Check by changing the bootlist and rebooting noting the address of the disk:
####bootlist -m normal -o hdisk0
####bootinfo -b                  Checks the disk booted to



REPLACE A MIRRORED DISK:
unmirrorvg workvg hdisk7
reducevg workvg hdisk7
rmdev -l hdisk7 –d
NOW REPLACE THE PHYSICAL DRIVE
extendvg workvg hdisk7
mirrorvg workvg
mirrorvg -S -c 3 workvg

FIX DISK ISSUES WHEN DISK IS STILL WORKING:
1. Connect new disk to system.
2. Add new disk to volume group:
# extendvg vg_name hdiskY
3. Migrate old disk to new disk: (*)
# migratepv hdiskX hdiskY
4. Remove old disk from volume group:
# reducevg vg_name hdiskX
5. Remove old disk from ODM:
# rmdev -l hdiskX -d

NOTE: if this is rootvg then step 3 is:
3. Disk contains hd5?
# migratepv -l hd5 hdiskX hdiskY
# bosboot -ad /dev/hdiskY
# chpv -c hdiskX
# bootlist -m normal hdiskY
Migrate old disk to new disk:
# migratepv hdiskX hdiskY


FIX Disk in Missing or Removed State
1. Identify all LVs and file systems on failing disk:
# lspv -l hdiskY
2. Unmount all file systems on failing disk:
# umount /dev/lv_name
3. Remove all file systems and LVs from failing
disk:
# smit rmfs # rmlv lv_name
4. Remove disk from volume group:
# reducevg vg_name hdiskY
5. Remove disk from system:
# rmdev -l hdiskY -d
6. Add new disk to volume group:
# extendvg vg_name hdiskZ
7. Re-create all LVs and file systems on new disk:
# mklv -y lv_name # smit crfs
8. Restore file systems from backup:
# restore -rvqf /dev/rmt0


FIX Total rootvg Failure
1. Replace bad disk
2. Boot in maintenance mode
3. Restore from a mksysb tape
4. Import each volume group into the new ODM (importvg) if needed


FIX Total non-rootvg Failure
1. Export the volume group from the system:
# exportvg vg_name
2. Check /etc/filesystems.
3. Remove bad disk from ODM and the system:
# rmdev -l hdiskX -d
4. Connect new disk.
5. If volume group backup is available (savevg):
# restvg -f /dev/rmt0 hdiskY
6. If no volume group backup is available: Recreate
...
- Volume group (mkvg)
- Logical volumes and file systems (mklv, crfs)
Restore data from a backup:
# restore -rqvf /dev/rmt0



CORRECT A MIRROR THAT HAS THE QUORUM ON WITH SINGLE MIRROR:
A)  rootvg:
chvg -Qn rootvg
bosboot -ad /dev/hdiskX
Reboot

B) non-rootvg
chvg -Qn datavg
varyoffvg datavg
varyonvg datavg


IMPORTING/EXPORTING A VOLUME GROUP
To export a volume group:
1. Unmount all file systems from the volume group:
# umount /dev/lv10
# umount /dev/lv11
2. Vary off the volume group:
# varyoffvg myvg
3. Export volume group:
# exportvg myvg
The complete volume group is removed from the ODM.

To import a volume group:
1. Configure the disk(s).
2. Import the volume group:
# importvg -y myvg hdisk3
3. Mount the file systems:
# mount /dev/lv10
# mount /dev/lv11
The complete volume group is added to the ODM.


STRIPING ACROSS SAN LUNS WITH MPIO (AIX 5.2 or >)

1)            smitty mkvg OR                 ex. mkvg -f -s 16 -y datavg hdisk1
                #####create new VG with the disks to be striped (i.e. SAN)
2)            Exit out then do:
                lsvg datavg                          ####Check VG LTG ex. size (Dynamic): 256 kilobyte(s)
3)            Do a smitty mklv, take Logical Volume then Add Logical Volume and then you see all the options. Make sure you select both disks in the "Physical Volume names" field and change "stripe Size" (near the bottom) - by hitting TAB (recommended 64K to 256K).

4)            Once created build the filesystem with: smitty jfs2
Take the "Add an Enhanced Journaled File System on a Previously Defined Logical Volume"
Option find the LV you just created.

5)            Once done don't forget to mount the new filesystem with: mount /mynewfs
6)            NOTE: lspath -l hdiskX to see paths or pcmpath query adapter (device) or datapath query adapter (device) will show paths in >AIX 5.3
db6(root)
[/]# lspath -l hdisk113
Enabled hdisk113 fscsi0
Enabled hdisk113 fscsi0
Enabled hdisk113 fscsi0
Enabled hdisk113 fscsi0
Enabled hdisk113 fscsi3
Enabled hdisk113 fscsi3
Enabled hdisk113 fscsi3
Enabled hdisk113 fscsi3


Creating a JFS2 (Enhanced JFS) Filesystem:
mklv -y 'name_log' -t 'jfs2log' rootvg 2
Now do a smitty crfs to create an jfs2 filesystem


ERROR REPORTING AND DIAGNOSTICS
*******************************************************************************
errpt                                      shows error headets
                                                errpt –a                 Shows detailed error logs
                                                errpt –a –j error_ID          Shows specific error
Comfiguring the errpt:
smit errdaemon
smit errclear

Syslog monitoring            
After changing /etc/syslog.conf:
# refresh -s syslogd

/usr/lpp/diagnostics/bin/diagrpt -r                                Run a diagnostics log

DUMPS:
sysdumpdev -l                                                     List dump values
sysdumpdev -p /dev/sysdumpnull                  Deactivate primary dump device
sysdumpdev -P -s /dev/rmt0                            Change secondary dump device
sysdumpdev -L                                                    Display information about last dump
sysdumpdev -e                                                     Estimate Dump Device
sysdumpdev -C                                                    Turn on dump compression
dumpcheck                                                           Verifies dump configuration

Sending a Dump to IBM
Copy all system configuration data including a dump onto tape:
# snap -a -o /dev/rmt0
Note: There are some AIX 5L V5.3 enhancements to snap
Label tape with:
– Problem Management Record (PMR) number
– Command used to create tape
– Block size of tape
Support Center uses kdb to examine the dump
*******************************************************************************

-----------------------------------------------------------------------------------------------------
Performance Issues:

1)            ps aux                    Checks %CPU and % mem per proces
2)            sar 5 5                  
3)            topas OR topas –P
4)            ps –elf                    Shows high priority processes (normal nice NI  value is 60)                       
5)            tprof
                # tprof -x sleep 60
# more sleep.prof
6)            vmstat 5                Look at PI/PO (page in/out) – if high system may need more mem
                                                If WA is high, the system is waiting on I/O
7)            svmon -Pt 3          Display top 3 memory hogs
8)            iostat 10 2             Look at I/O wait
9)            filemon                 Monitors file usage
# filemon -o fmout
# trcstop
# more fmout     


Using nice and renice (PRI and NI values):
# nice -n 15 backup_all &
# ps -el


# renice -n -10 3860
# ps –el



smtctl [ -m off | on [ -w boot | now]]                                Enable multithreading
--------------------------------------------------------------------------------------------------------    
mkdev -c disk -s subclass -t type -p parentname -w whereconnected –a pv=yes ----- Make a disk available as a physical volume

chdev -l hdisk1 -a pv=yes  --- Change physical device to a logical volume

chpv -a n hdisk1  ----turn off allocation permission, y turns it on

chpv -v r pvname  ---change state of pv to unavailable, a makes available

rmdev -l hdisk1 ---removes a physical volume from system

reducevg VGNname SourceDiskNumber  ---remove a source disk from a volume group

rmdev -l SourceDiskNumber –d  ---removes a physical disk

migratepv hdisk1 hdisk6 hdisk7  --- migrates physical partitions from 1 to 6 and 7

mkvg -y myvg -d 10 -s 8 hdisk1 hdisk5  ---make a volume group

chvg -ay newvg – turn on auto-vary on of a volume group, n turns off

chvg -u newvg ---unlock a volume group after system crash

extendvg newvg hdisk3  --- add physical drive to volume group

reducevg myvg hdisk3  ----remove physical volume from volume group

reducevg VolumeGroup 000005265ac63976 --- remove physical volume PVID (reference) from volume group

exportvg myvg | importvg myvg hdiskx  ---- import or export a volume group

varyoffvg myvg | varyonvg myvg ---- vary on/off a volume group

reorgvg vg02 lv03 lv04 lv07 ---- reoganize logical volumes within a volume group

syncvg -p hdisk04 hdisk05  ---- sync copies of volumes on 4 and 5

mklv -y newlv -c 2 rootvg 10 ---- make logical volume with 10 logical partitions of 2 physical partitions each

rmlv newlv --- remove logical volume

extendlv newlv 3  ---add three more logical partitions to the logical volume

cplv -v myvg -y newlv oldlv  ---This copies the contents of oldlv to a new logical volume called newlv in the
volume group myvg.

lsvg | lsvg –il --- list logical volumes

lslv --- list logical volume properties

crfs -v jfs -g rootvg -a size=8192 -m /dummy
This will create a journaled file system of 4 MB with /dummy as the mount point in the rootvg volume group.
mount / umount ---- mount and unmount filesystems

chfs -a size=<new size in 512-byte blocks> <file system name>  ---- change filesystem size

logform LogName ---- create journaled filesystem log

lsfs –q filesystem ---determine large file enabled filesystems

vmstat ----check system paging space

lsps –a -----list paging space utilization

chps--- Changes the attributes of a paging space.
lsps--- Displays the characteristics of a paging space.
mkps--- Creates an additional paging space.
rmps--- Removes an inactive paging space.
swapon--- Activates a paging space.

pg /etc/swapspaces--- file tracking swapon swapspaces

mkszfile ---saves the system state for reinstallation on the current system or on another system. Also creates the /image.data file.

mksysb -e /dev/rmt0 ---create bootable system image with the -e flag to exclude the contents of the exclude.rootvg file

savevg -if /dev/rmt0 uservg ---back up uservg

tar -cvf /dev/fd0 *  ---back up floppy files

cd /userdirectory
find . -depth | backup -i -f /dev/rmt0   ----backup using relative path

cd/
find /userdirectory -depth | cpio -o -c -v -B > /dev/rmt0  ------back up using absolute path

tctl -f /dev/rmt0 rewind  ---rewind a tape

restore -T -d -v -q -s4 -f /dev/rmt0.1  ----list info on tape

restore -x -d -v -q -s4 -f /dev/rmt0.1 ./etc/hosts  ---restore the hosts file from tape, alternatively use tar -x -v -f /dev/rmt0 /etc/hosts

tctl -f /dev/rmt0 rewind
restore -x -d -v -s4 -f/dev/rmt0.1 ./var/dt  ---restore directory, alternatively tar -x -v -f /dev/rmt0 /var/dt OR cpio -i -c -v -d -u -m -B < /dev/rmt0 "/var/dt/*"

dd if=/dev/rmt0 bs=51200 | restore –xvqf  ---restore when block  size unknown

dd if=/dev/fd0 of=/tmp/ddcopy
dd if=/tmp/ddcopy of=/dev/fd0   ----duplicate diskette

tcopy /dev/rmt0 /dev/rmt1  ----duplicate tape

tctl -f /dev/rmt0 reset  ---reset tape unit

System Resource Controller – controls subsystem processes and can be checked by using:  man srcmstr

You can add :  mkitab -i fbcheck srcmstr:2:respawn:/usr/sbin/srcmstr

To /etc/inittab to start it then do a telinit q so it will take effect

startsrc – start a process or process group

Syslog – configured from /etc/syslog.conf.  To catch warning messages add a line to this file such as:
*.warning /var/spool/syslog
chmod 666 /var/spool/syslog
refresh -s syslogd

stopsrc -s syslogd OR startsrc –s syslogd ----starts or stops syslog daemon

crontab –e ------edits the system crontab file for scheduling.  Add a command to the file in the following format: minute hour day_of_month month weekday command
crontab –l ---show commented housekeeping commands that can be edited with crontab –e

skulker ----removes unwanted temp files

/usr/lib/spell/compress -----compress spell log

smdemon.cleanu ----cleans sendmail command queue

rc.tcpip  ---file initializing inetd, rwhod, sendmail, gated, etc as well as lpd and portmap which converts RPC  program numbers to Internet port numbers – can be stopped/started with startsrc or stopsrc.  Remove it to start with no tcpip daemons

sh /etc/tcp.clean  ---script to stop/start all tcpip daemons

refresh –s inetd ----refresh inetd after edit, which controls telnet/ftp as well as some other service daemons

/etc/netsvc.conf  ---overrides default resolution name resolution order i.e. hosts = bind,nis,local or by using the command export NSORDER=bind,nis,local

/etc/resolv.conf  ----sets name servers

no -o ipforwarding=1  ---sets up ip routing.  To configure the interfaces themselves use smitty – setting lost after reboot so set in a script

smit route ----smitty addroute command, alternatively route add -net 192.168.1 -netmask 255.255.255.0 9.3.1.124

ifconfig tr0 9.3.1.96 netmask 255.255.255.0 alias ----IP Aliasing.  To delete use ifconfig tr0 9.3.1.96 netmask 255.255.255.0 delete

$HOME/.netrc  ---sets up rexec and ftp automatic login

uname --- gets system information such as release/version info.

mknfs –N  ----starts NFS creation immediately, with –B starts on next reboot w/inittab.  Alternatively smitty mknfs or startsrc nfsd

lssrc -a ---check to see if daemon is running in entire list

/etc/exports  ----NFS exports file.  After changing run :  exportfs –a

exportfs -i /dirname  ----immediately and temporarily NFS export a directory.  exportfs –U /dirname immediately unexports a directory after editing /etc/exports

/etc/vfs  ---check to ensure nfs is default remote filesystem by commenting out pound signs if they are present then restart  nfs

/etc/filesystems  ---contains nfs mounts at startup or can also be mounted by running mount –a

showmount ----shows current mounted filesystems

/usr/sbin/automount -v /backup /tmp/mount.map  ---- Define a map file using the command line interface where /backup is mount point.  An example map file can be found in /usr/samples/nfs.  Then restart nfsd and automountd to automatically mount filesystems when they are needed and called by a program.

lssrc –s nfsd ---list nfsd status

mount –t nfs_mount  ----mount an nfs filesystem.  Can be unmounted with umount /dirname

The following is a list of NFS Commands.
chnfs Starts a specified number of biod and nfsd daemons.
mknfs Configures the system to run NFS and starts NFS daemons.
nfso Configures NFS network options.
automount Mounts an NFS automatically.
chnfsexp Changes the attributes of an NFS-exported directory.
chnfsmnt Changes the attributes of an NFS-mounted directory.
exportfs Exports and unexports directories to NFS clients.
lsnfsexp Displays the characteristics of directories that are exported
with NFS.
lsnfsmnt Displays the characteristics of mounted NFS systems.
mknfsexp Exports a directory using NFS.
mknfsmnt Mounts a directory using NFS.
rmnfs Changes the configuration to stop the NFS daemons.
rmnfsexp Removes NFS-exported directories from a server's list of
exports.
rmnfsmnt Removes NFS-mounted file systems from a client's list of
mounts.

/usr/bin/rpcinfo -p server_name  ----verify if nfs daemons running and version/port info

If the rpc.mountd daemon dies after starting, and this error is
received at a client machine, then do the following:
1. Telnet to the server and log in as root.
2. cd to the /etc directory
3. Enter stopsrc -g nfs.
4. Enter stopsrc -s portmap.
5. Enter rm -rf state sm sm.bak xtab rmtab.
6. Enter startsrc -s portmap.
7. Enter startsrc -g nfs.
8. Enter exportfs -a.
9. showmount -e servername.

Troubleshooting commands:
iostat Reports CPU and I/O statistics.
vmstat Reports virtual-memory activity and other system statistics.
netstat Displays the contents of network-related data structures.
ps Displays the status of processes.
lsattr Displays the attributes of devices.
lslv Displays information about a logical volume or the logical volume
allocations of a physical volume.
nfsstat Displays statistics about Network File System (NFS) and Remote
Procedure Call (RPC) activity.
nice Runs a command at higher- or lower-than-normal priority.
no Displays or sets network options.
renice Changes the priority of one or more processes.
reorgvg Reorganizes the physical-partition allocation within a volume
group.
sar Collects and reports or records system-activity information.
time Prints the elapsed execution time and the user and system
processing time attributed to a command.
trace Records and reports selected system events.

User Related Commands

mkuser Creates a new user.
passwd Creates or changes the password of user.
chuser Changes user attributes (except password).
lsuser Lists user attributes.
rmuser Removes a user and its attributes.
chsec Changes security related stanzas.
login Initiates a user session.
who Identifies the users currently logged in.
dtconfig Enables or disables the desktop autostart feature.

/etc/security/environ Contains the environment attributes for
users.
/etc/security/lastlog Contains the last login attributes for users.
/etc/security/limits Contains process resource limits for
users.
/etc/security/user Contains extended attributes for users.
/usr/lib/security/mkuser.default Contains the default attributes for new
users.
/etc/passwd Contains the basic attributes of users.
/etc/security/passwd Contains password information.
/etc/security/login.cfg Contains configuration information for
login and user authentication.
/etc/utmp Contains the record of users logged into
the system.
/var/adm/wtmp Contains connect time accounting
records.
/etc/security/failedlogin Records all failed login attempts.
/etc/motd Contains the message to be displayed
every time a user logs in to the system.
/etc/environment Specifies the basic environment for all
processes.
/etc/group Contains the basic attributes of groups.
/etc/security/group Contains the extended attributes of
groups.

Prompt Variables

PS1 Prompt used as the normal system prompt.
PS2 Prompt used when the shell expects more input.
PS3 Prompt used when you have root authority.

xinit /usr/dt/bin/Xsession  ----starts X11

/usr/dt/bin/dtlogin –daemon   ----start CDE

cat /var/dt/Xpid  ----determine Login Manager PID then kill with: kill -term process_id

/etc/qconfig  ---contains AIX printer queue definitions….printers are created using smitty

lpstat ---- displays information about the current status of the line printer.

qstat ---- displays the current status information regarding specified print jobs, print queues, or users.

lpq  --- command reports the status of the specified job or all jobs associated with the specified UserName and JobNumber variables.

enq -D -P 'lpforu:lp0'  ----disable print queue

qcan -Plpforu -x3  ----cancel print job

/var/spool/lpd/qdir  ----place for print queue entries

startsrc -s sendmail  ----start sendmail, alternatively use /usr/lib/sendmail

refresh -s sendmail  ---refresh sendmail after config change

/usr/sbin/sendmail -q15d  ---process the mail queue every 15 days.  Use following time variables after q:  s Seconds,m Minutes, h Hours,d Days,w Weeks.  With –v forces the queue to run.

/var/spool/mqueue  ---sendmail queue location

SET THE FOLLOWING TO CONFIGURE SENDMAIL RELAYHOST:
In sendmail.cf
DS[postoffice.equifax.com]
The do a stopsrc and startsrc on sendmail.

Moving the mail queue:
1. Stop the sendmail daemon.
2. Move the entire queue directory by entering:
cd /var/spool
mv mqueue omqueue
3. Restart the sendmail daemon.
4. Process the old mail queue by entering:
/usr/sbin/sendmail -oQ/var/spool/omqueue -q
The -oQ flag specifies an alternate queue directory. The -q flag specifies
to run every job in the queue. To get a report about the progress of the
operation, use the -v flag. This operation can take a long time.
5. Remove the log files and the temporary directory when the queue is empty
by entering:
rm /var/spool/omqueue/*
rmdir /var/spool/omqueue

Logging Sendmail:
1.  uncomment this in /etc/syslog.conf ----mail.debug /var/spool/mqueue/log
2.  refresh -s syslogd

/usr/lib/smdemon.cleanu  ----cleanup mail logs

touch /var/tmp/sendmail.st  ---create file to track sendmail stats

/usr/sbin/mailstats  ---display mail stats

Creating/Editing Mail Aliases

1. Edit the /etc/aliases file.
2. On a blank line, add an alias followed by a colon (:) followed by a list of
comma-separated recipients. For example, the following entry defines an
alias named programer to be the names of the people in that group.
programer: john, smith, mary@sv1051c, bob@sv1051c
3. Create an owner for any distribution list aliases. If the sendmail command
has trouble sending mail to the distribution list, it sends an error message
to the owner of that list. For example, the owner of the above list is root of
system sv1051a and is defined by the following entry in /etc/aliases file:
owner-sys: root@sv1051a
4. Recompile the /etc/aliases file with /usr/sbin/sendmail or newaliases.

mail user@system.domain  ---mails a user

/usr/lib/X11/fs/config  ----contains settings for the font server.  Can be started with xfsconf then startsrc -s xfs

Helpful Restore Commands:
tar The tar command manipulates archives by writing files to, or
retrieving files from, an archive storage medium. The files used by
the tar command are represented by the File parameter. If the
File parameter refers to a directory, then that directory and,
recursively, all files and directories within it are referenced as well.

cpio The cpio command copies files into and out of archive storage and
directories.

dd The dd command reads the InFile parameter or standard input,
does the specified conversions, then copies the converted data to
the OutFile parameter or standard output. The input and output
block size can be specified to take advantage of raw physical I/O.
mksysb The mksysb command creates an installable image of the root
volume group either in a file or onto a bootable tape.

backup The backup command creates copies of your files on a backup
medium, such as a magnetic tape or diskette. The copies are in
one of the two backup formats: Either specific files backed up
(using the -i flag), or the entire file system backed up by i-node

restore The restore command reads archives created by the backup
command and extracts the files stored on them. These archives
can be in either file-name or file-system format.





AIX Command Crib Sheet

OS LEVEL : AIX 
DATE     : 29/01/2001
VERSION  : 1.8

>> Latest version can be found at  http://www.mort.level5.net/johnr/howto/aix.txt <<

---------------------------------------------------------------------------- 
                                 MISCELLENEOUS 
----------------------------------------------------------------------------

http://www.rs6000.ibm.com/cgi-bin/ds_form        Web based man pages
oslevel                       Returns operating system level

whence (program)              Returns full path of program 
whereis (program)             Returms full path of program


what (program)                Displays identifying info from the executable 
                              like version number, when compiled.


lslpp -L all                  list all installed software 
lslpp -L (program set name)   Check if software installed 
lslpp -f                      Lists filesets vs packages 
lslpp -ha                     Lists installation history of filesets


instfix -ik (fix number eg IX66617)     Checks id fix is installed 
instfix -ik 4330-02_AIX_ML

compress -c file.txt > file.Z           Create a compressed file.

uuencode (infile) (extract-file-name) > (output file) 
Converts a binary file to an ASCII file for transfer by modem or email


uudecode (encoded file) 
Extracts a binary file from encoded file and calls it the extract-file-name

examples :-

uuencode maymap maymap > maymap.enc 
uuencode maymap.enc


od -c /tmp            Displays contents of the /tmp directory file 
ls -i                 Lists files with their inode numbers 
echo *                Lists files, can be used if ls is corrupt/missing

alog -o -t boot       View the boot log

chtz (timezone eg GMT0BST)        Changes the timezone in /etc/environment file 
chlang (language eg En_GB)        Changes the language in /etc/environment file


ar -v -t (archive file)           List contents of an archive 
ar -v -x (archive file)           Extracts the archive 
ar -v -t /usr/lib/libC-r.a        Lists contents of the libC_r.a library


find /source -print | cpio -pdm /target 
Copying directories using cpio, creates /target/source directory.

dump -nTv (binary executable)     Displays the contents of an executable file

dump -c        Displays string information 
dump -o        Displays object file headers 
dump -l        Displays line numbers 
dump -s        Displays the text section


snap -ao /dev/rmt0         Create a snapshot onto tape 
snap -ad (directory)       Create a snapshot into a named directory other 
                           than the default (/tmp/ibmsupt)


/usr/dt/bin/dtconfig -d    Disables desktop logins 
/usr/dt/bin/dtconfig -e    Enables desktop logins 
/var/dt/Xpid               PID of the dtlogin process


-------------------------------------------------------------------------------- 
                                TERMINALS 
--------------------------------------------------------------------------------

tty            Displays what the tty/pty number of the terminal is.

termdef        reports the termtype setup in smit for the tty port 
               that termdef is run on.

chdev -l (device eg tty1) -a term=vt100     Sets tty to a vt100 terminal type

penable tty0      adds getty line into /etc/inittab for tty0 and starts getty 
pdisable tty0     disables the getty line and disables getty

penable / pdisable -a option is for all

stty erase ^?     Set backspace key for vt100 terminals 
stty erase ^H     Set backspace key for wyse50 terminals


lscons                                              Displays the console device 
chcons -a login=enable (device eg /dev/tty1)        Changes the console device 
 

Create ttys on ports 0 to 7 on adapter sa2 :-

for i in 0 1 2 3 4 5 6 7 
do 
  mkdev -c tty1 -t tty -s rs232 -p sa2 -w$i -a login=enable -a term=vt100 
done


portmir -t /dev/tty0     Mirror current terminal onto /dev/tty0 
portmir -o               Turns off port mirroring


-------------------------------------------------------------------------------- 
                                NETWORK 
--------------------------------------------------------------------------------

host (ip or hostname)      Resolves a hostname / ip address

hostname                   Displays hostname 
hostname (hostname)        Sets the hostname until next reboot


chdev -l (device name) -a hostname=(hostname)    Changes hostname permanently 
chdev -l inet0 -a hostname=thomas


ifconfig (device name)              Displays network card settings 
ifconfig (device name) up           Turns on network card 
ifconfig (device name) down         Turns off network card 
ifconfig (device name) detach       Removes the network card from the 
                                    network interface list 
ifconfig en0 inet 194.35.52.1 netmask 255.255.255.0 up

ifconfig lo0 alias 195.60.60.1      Create alias ip address for loopback

route (add/delete) (-net/-host) (destination) (gateway) 
Adds or deletes routes to other networks or hosts, does not update 
the ODM database and will be lost at reboot. 
route add -net 194.60.89.0 194.60.90.4


lsattr -EHl inet0                  Displays routes set in ODM and hostname 
odmget -q "name=inet0" CuAt        Displays routes set in ODM and hostname


refresh -s inetd           Refresh inetd after changes to inetd.conf 
kill -1 (inetd PID)        Refresh inetd after changes to inted.conf


netstat -i                             Displays interface statistics 
entstat -d (ethernet adapter eg en0)   Displays ethernet statistics

arp -a         Displays ip to mac address table from arp cache

no -a          Displays network options use -o to set individual options or 
               -d to set individual options to default. 
               no -o option=value (this value is reset at reboot) 
               no -o "ipforwarding=1"


traceroute (name or ipaddress)        Displays all the hops from source to 
                                      destination supplied.

ping -R (name or ipaddress)           Same as traceroute except repeats.

-------------------------------------------------------------------------------- 
                                N.F.S. 
--------------------------------------------------------------------------------

exportfs                        Lists all exported filesystems
exportfs -a                     Exports all fs's in /etc/exports file
exportfs -u (filesystem)        Un-exports a filesystem
mknfs                           Configures and starts NFS services
rmnfs                           Stops and un-configures NFS services
mknfsexp -d /directory          Creates an NFS export directory
mknfsmnt                        Creates an NFS mount directory
mount hostname:/filesystem /mount-point    Mount an NFS filesystem

nfso -a                                    Display NFS Options 
nfso -o option=value                       Set an NFS Option 
nfso -o nfs_use_reserved_port=1


-------------------------------------------------------------------------------- 
                                BACKUPS 
--------------------------------------------------------------------------------


MKSYSB 
------


mkszfile -f                Creates /image.data file (4.x onwards) 
mkszfile -X                Creates /fs.size file    (3.x)

mksysb (device eg /dev/rmt0)

CPIO ARCHIVE 
------------

find (filesystem) -print | cpio -ocv > (filename or device)
eg find ./usr/ -print | cpio -ocv > /dev/rmt0

CPIO RESTORE 
------------


cpio -ict < (filename or device) | more        Lists archive 
cpio -icdv < (filename or device) 
cpio -icdv < (filename or device) ("files or directories to restore")


eg cpio -icdv < /dev/rmt0 "tcpip/*"             Restore directory and contents 
   cpio -icdv < /dev/rmt0 "*resolve.conf"       Restore a named file


TAR ARCHIVE 
-----------

tar -cvf (filename or device) ("files or directories to archive")
eg tar -cvf /dev/rmt0 "/usr/*"

TAR RESTORE 
-----------

tar -tvf (filename or device)                        Lists archive

tar -xvf (filename or device)                        Restore all 
tar -xvf (filename or device) ("files or directories to restore") 
use -p option for restoring with orginal permissions


eg tar -xvf /dev/rmt0 "tcpip"                   Restore directory and contents 
   tar -xvf /dev/rmt0 "tcpip/resolve.conf"      Restore a named file


AIX ARCHIVE 
-----------


find (filesystem) -print | backup -iqvf (filename or device) 
Backup by filename.

eg find /usr/ -print | backup -iqvf /dev/rmt0

backup -(backup level 0 to 9) -f (filename or device) ("filesystem") 
Backup by inode.

eg backup -0 -f /dev/rmt0 "/usr"        -u option updates /etc/dumpdates file

AIX RESTORE 
-----------

restore -qTvf (filename or device)                        Lists archive

restore -qvxf (filename or device)                        Restores all 
restore -qvxf (filename or device) ("files or directories to restore") 
        (use -d for restore directories)

restore -qvxf /dev/rmt0.1 "./etc/passwd"     Restore /etc/passwd file

restore -s4 -qTvf /dev/rmt0.1                Lists contents of a mksysb tape 
 


BACKUPS ACROSS A NETWORK 
------------------------


To run the backup on a local machine (cpio) and backup on the remote 
machine's (remhost) tape drive (/dev/rmt0)


find /data -print | cpio -ocv | dd obs=32k | rsh remhost \ 
"dd ibs=32k obs=64k of=/dev/rmt0"

To restore/read the backup (cpio) on the remote machine
dd ibs=64k if=/dev/rmt0 | cpio -icvt

To restore/read the backup (cpio) on the local machine from the remote 
machine's (remhost) tape drive (/dev/rmt0)


rsh remhost "dd ibs=64k obs=32k if=/dev/rmt0" | dd ibs=32k \ 
| cpio -icvt


To run the backup (cpio) on a remote machine (remhost) and backup to 
the local machines tape drive (/dev/rmt0)


rsh remhost "find /data -print | cpio -icv | dd ibs=32k" \ 
| dd ibs=32k obs=64k of=/dev/rmt0 
 


-------------------------------------------------------------------------------- 
                        Copying diskettes and tape 
--------------------------------------------------------------------------------


COPYING DISKETTES 
-----------------


dd if=/dev/fd0 of=(filename) bs=36b 
dd if=(filename) of=/dev/fd0 bs=36b conv=sync         or flcopy 
 


COPYING TAPES 
-------------


dd if=/dev/rmt0 of=(filename) 
dd if=(filename) of=/dev/rmt0        or tcopy


-------------------------------------------------------------------------------- 
                                VI Commands 
--------------------------------------------------------------------------------

:g/xxx/s//yyy/   global change where xxx is to be changed by yyy

sed 's(ctrl v ctrl m)g//g' old.filename > new.filename 
Strips out ^M characters from ascii files that have been transferred as binary. 
To enter crontrol characters type ctrl v then ctrl ? where ? is whatever 
ctrl character you need.


-------------------------------------------------------------------------------- 
                                DEVICES 
--------------------------------------------------------------------------------


lscfg                          lists all installed devices 
lscfg -v                       lists all installed devices in detail 
lscfg -vl (device name)        lists device details


bootinfo -b                    reports last device the system booted from 
bootinfo -k                    reports keyswitch position 
                               1=secure, 2=service, 3=normal


bootinfo -r                    reports amount of memory (/ by 1024) 
bootinfo -s (disk device)      reports size of disk drive 
bootinfo -T                    reports type of machine ie rspc

lsattr -El sys0 -a realmem     reports amount of useable memory

mknod (device) c (major no) (minor no)        Creates a /dev/ device file. 
mknod /dev/null1 c 2 3


lsdev -C        lists all customised devices ie installed 
lsdev -P        lists all pre-defined devices ie supported 
lsdev -(C or P) -c (class) -t (type) -s (subtype)


chdev -l (device) -a (attribute)=(new value)         Change a device attribute 
chdev -l sys0 -a maxuproc=80


lsattr -EH -l (device) -D         Lists the defaults in the pre-defined db 
lsattr -EH -l sys0 -a modelname


rmdev -l (device)           Change device state from available to defined 
rmdev -l (device) -d        Delete the device 
rmdev -l (device) -SR       S stops device, R unconfigures child devices

lsresource -l (device)  Displays bus resource attributes of a device.

Power Management (PCI machines) 
-------------------------------

pmctrl -a            Displays the Power Management state

rmdev -l pmc0        Unconfigure Power Management 
mkdev -l pmc0        Configure Power Management


-------------------------------------------------------------------------------- 
                                TAPE DRIVES 
--------------------------------------------------------------------------------

rmt0.x where x = A + B + C

A = density        0 = high      4 = low 
B = retension      0 = no        2 = yes 
C = rewind         0 = no        1 = yes


tctl -f (tape device) fsf (No)        Skips forward (No) tape markers 
tctl -f (tape device) bsf (No)        Skips back (No) tape markers 
tctl -f (tape device) rewind          Rewind the tape 
tctl -f (tape device) offline         Eject the tape 
tctl -f (tape device) status          Show status of tape drive


chdev -l rmt0 -a block_size=512        changes block size to 512 bytes 
                                       (4mm = 1024, 8mm = variable but 
                                        1024 recommended)


bootinfo -e             answer of 1 = machine can boot from a tape drive 
                        answer of 0 = machine CANNOT boot from tape drive

diag -c -d (tape device)        Hardware reset a tape drive.
tapechk (No of files)           Checks Number of files on tape.
< /dev/rmt0                     Rewinds the tape !!!

-------------------------------------------------------------------------------- 
                        PRINTERS / PRINT QUEUES 
--------------------------------------------------------------------------------


splp (device)                   Displays/changes printer driver settings 
splp /dev/lp0

export $LPDEST="pqname"         Set default printer queue for login session
lsvirprt                        Lists/changes virtual printer attributes.
rmvirprt -q queuename -d queuedevice        Removes a virtual printer
qpri -#(job No) -a(new priority)            Change a queue job priority.

qhld -#(job No)                Put a hold on hold 
qhld -r #(job No)              Release a held job


qchk -A                        Status of jobs in queues 
lpstat 
lpstat -p(queue)               Status of jobs in a named queue


qcan -x (job No)               Cancel a job from a queue 
cancel (job No)


enq -U -P(queue)               Enable a queue 
enable (queue)


enq -D -P(queue)               Disable a queue 
disable (queue)

qmov -m(new queue) -#(job No)  Move a job to another queue

startsrc -s qdaemon            Start qdaemon sub-system 
lssrc -s qdaemon               List status of qdaemon sub-system 
stop -s qdaemon                Stop qdaemon sub-system 
 


-------------------------------------------------------------------------------- 
                                FILE SYSTEMS 
--------------------------------------------------------------------------------


Physical Volumes (PV's) 
-----------------------


lspv                        Lists all physical volumes (hard disks) 
lspv (pv)                   Lists the physical volume details 
lspv -l (pv)                Lists the logical volumes on the physical volume 
lspv -p (pv)                Lists the physical partition usage for that PV

chdev -l (pv) -a pv=yes     Makes a new hdisk a pysical volume.

chpv -v r (pv)              Removes a disk from the system. 
chpv -v a (pv)              Adds the removed disk back into the system. 
chpv -a y (pv)              Changes pv allocatable state to YES 
chpv -a n (pv)              Changes pv allocatable state to NO


migratepv (old pv) (new pv)     Moves all LV's from one PV to another PV, both 
                                PV's must be in the same volume group.


Volume Groups (VG's) 
--------------------


lsvg              Lists all volume groups 
lsvg (vg)         Lists the volume group details 
lsvg -l (vg)      Lists all logical volumes in the volume group 
lsvg -p (vg)      Lists all physical volumes in the volume group 
lsvg -o           Lists all varied on volume groups


varyonvg (vg)           Vary On a volume group 
varyonvg -f (vg)        Forces the varyon process 
varyonvg -s (vg)        Vary on a VG in maintenance mode. LV commands can be 
                        used on VG, but LV,s cannot be opened for I/O. 
varyoffvg (vg)          Vary Off a volume group

synclvodm (vg)          Tries to resync VGDA, LV control blocks and ODM.

mkvg -y(vg) -s(PP size) (pv)    Create a volume group 
mkvg -y datavg -s 4 hdisk1


reducevg -d (vg) (pv)   Removes a volume group 
reducevg (vg) (PVID)    Removes the PVID disk reference from the VGDA when a 
                        disk has vanished without the reducevg (vg) (pv) 
                        command being run first. 
  
extendvg (vg) (new pv)        Adds another PV into a VG.

exportvg (vg)                 Exports the volume group eg deletes it!

Note : Cannot export a VG if it has active paging space, turn off paging, 
       reboot before exporting VG. Exporting removes entries from filesystems 
       file but does not remove the mount points.

chvg -a y (vg)                  Auto Vary On a volume group at system start.
lqueryvg -Atp (pv)              Details volume group info for the hard disk.

importvg -y (vg name) (pv)      Import a volume group from a disk. 
importvg (pv)                   Same as above but VG will be called vg00 etc.


chvg -Q (y/n) (vg name)         Turns on/off Quorum checking on a vg. 
 


Logical Volumes (LV's) 
----------------------


lslv (lv)                    Lists the logical volume details 
lslv -l (lv)                Lists the physical volume which the LV is on


mklv (vg) (No of PP's) (pv Name optional)       Create a logical volume 
mklv -y (lv) (PP's) (pv name optional)          Creates a named logical volume


chlv -n (new lv) (old lv)                       Rename a logical volume 
extendlv (lv) (extra No of PP's)                Increase the size of an LV
rmlv (lv)                                       Remove a logical volume


mklv/extendlv -a = PP alocation policy 
-am = middle   -ac = center   -ae = edge 
-aie = inner edge    -aim = inner middle


migratepv -l (lv) (old pv) (new pv) 
Move a logical volume between physical volumes. Both physical volumes 
must be in the same volume group !


mklv -y (lv) -t jfslog (vg) (No of PP's) (pv Name optional) 
Creates a JFSlog logical volume.

logform (/dev/lv)       Initialises an LV for use as an JFSlog
getlvcb -AT (lv)        Displays Logical Volume Control Block information

File Systems (FS's) 
-------------------


lsfs            Lists all filesystems  in the 
lsfs -q (fs)    Lists the file system details


mount               Lists all the mounted filesystems 
mount (fs or lv)    Mounts a named filesystem 
mount -a            Mounts all filesystems 
mount all

mount -r -v cdrfs /dev/cd0 /cdrom        mounts cd0 drive over /cdrom

crfs -v jfs -d(lv) -m(mount point) -A yes 
Will create a file system on the whole of the logical volume, adds entry into 
/etc/filesystems and will create mount point directory if it does not exist.


crfs -v jfs -g(vg) -m(mount point) -a size=(size of fs) -A yes 
Will create a logical volume on the volume group and create the file system on 
the logical volume. All at the size stated. Will add entry into 
/etc/filesystems and will create the mount point directory if it does not exist.


chfs -A yes (fs)                 Change file system to Auto mount in 
                                 /etc/filesystems 
chfs -a size=(new fs size)(fs)   Change file system size


rmfs (fs)            Removes the file system and will also remove the 
                     LV if there are no onther file systems on it.


defrag -q (fs)       Reports the fragment status of the file system. 
defragfs -r (fs)     Runs in report only defrag mode (no action). 
defragfs (fs)        Defragments a file system.


fsck (fs)            Verify a file system, the file system must be unmounted! 
fsck (-y or -n) (fs) Pre-answer questions either yes or no ! 
fsck -p (fs)         Will restore primary superblock from backup copy if the 
                     superblock is corrupt.


Mirroring 
---------


mklv -y (lv) -c(copies 2 or 3) (vg) (No of PP's) (PV Name optional) 
Creates a mirrored named logical volume.


mklvcopy -s n (lv) (copies 2 or 3) (pv) 
Creates a copy of a logical volume onto another physical volume. The physical 
volume MUST be in the same volume group as the orginal logical volume !


rmlvcopy (lv) (copies 1 or 2)             Removes logical volume copies. 
rmlvcopy (lv) (copies 1 or 2) (pv)        From this pv only!


syncvg -p (pv)                            Synchronize logical partion copies 
syncvg -l (lv) 
syncvg -v (vg)


mirrorvg (vg) (pv) 
Mirrors the all the logical volumes in a volume group onto a new physical 
volume. New physical volume must already be part of the volume group.


-------------------------------------------------------------------------------- 
                        BOOT LOGICAL VOLUME (BLV) 
--------------------------------------------------------------------------------


bootlist -m (normal or service) -o                       displays bootlist 
bootlist -m (normal or service) (list of devices)        change bootlist


bootinfo -b                  Identifies the bootable disk 
bootinfo -t                  Specifies type of boot

bosboot -a -d (/dev/pv)      Creates a complete boot image on a physical volume.
mkboot -c -d (/dev/pv)       Zero's out the boot records on the physical volume.
savebase -d (/dev/pv)        Saves customised ODM info onto the boot device.

-------------------------------------------------------------------------------- 
                                SYSTEM DUMP 
--------------------------------------------------------------------------------


sysdumpdev -l        Lists current dump destination. 
sysdumpdev -e        Estimates dumpsize of the current system in bytes. 
sysdumpdev -L        Displays information about the previous dump.


sysdumpstart -p      Starts a dump and writes to the primary dump device. 
sysdumpstart -s      Starts a dump and writes to the secondary dump device.


(MCA machine can also dump if key is in service position and the reset 
 button is pressed)

sysdumpdev -p (dump device) -P        Sets the default dump device, permanently

Analyse dump file :- 
echo "stat\n status\n t -m" | crash /var/adm/ras/vmcore.0


-------------------------------------------------------------------------------- 
                                PAGING SPACE (PS's) 
--------------------------------------------------------------------------------


lsps -a                        Lists out all paging space 
lsps -s                        Displays total paging and total useage 
lsps (ps)


mkps -s(No of 4M blocks) -n -a (vg) 
mkps -s(No of 4M blocks) -n -a (vg) (pv) 
-n = don't activate/swapon now                -a = activate/swapon at reboot


chps -a n (ps)                       Turns off paging space. 
chps -s(No of 4M blocks) (ps)        Increases paging space.

chlv -n (new name) (old name)        Change paging space name

rmps (ps)               Remove paging space. PS must have been turned off 
                        and then the system rebooted before it can be removed.


Note : Need to change the swapon entry in /sbin/rc.boot script if you are 
       changing the default paging space from /dev/hd6. You also need to 
       do a "bosboot -a -d /dev/hdiskx" before the reboot.


/etc/swapspaces               File that lists all paging space devices that are 
                              activated/swapon during reboot.


-------------------------------------------------------------------------------- 
                                SCHEDULING 
--------------------------------------------------------------------------------


crontab -l                        List out crontab entrys 
crontab -e                        Edit crontab entrys 
crontab -l > (filename)           Output crontab entrys to a file 
crontab (filename)                Enter a crontab from a file 
crontab -r                        Removes all crontab entrys 
crontab -v                        Displays crontab submission time.


/var/adm/cron/cron.allow        File containing users allowed crontab use. 
/var/adm/cron/cron.deny         File containing users denied crontab use. 
/var/adm/cron/crontab           Directory containing users crontab entries.


at (now + 2 minutes, 13:05, etc) {return}        Schedule a job using at 
Command or schell script {return} 
{CTRL D}


at -l 
atq                      Lists out jobs scheduled to run via at command


at -r (at job No) 
atrm  (at job No)        Removes an at job scheduled to run.


/var/adm/cron/at.allow   File containing users allowed at use. 
/var/adm/cron/at.deny    File containing users denied at use. 
/var/adm/cron/atjobs     Directory containing users at entries.


-------------------------------------------------------------------------------- 
                                SECURITY 
--------------------------------------------------------------------------------


groups           Lists out the groups that the user is a member of 
setgroups        Shows user and process groups

chmod abcd (filename)        Changes files/directory permissions

Where a is  (4 SUID) + (2 SGID)  + (1 SVTX) 
      b is  (4 read) + (2 write) + (1 execute)  permissions for owner 
      c is  (4 read) + (2 write) + (1 execute)  permissions for group 
      d is  (4 read) + (2 write) + (1 execute)  permissions for others 
 


 -rwxrwxrwx   -rwxrwxrwx   -rwxrwxrwx 
  |||             |||             ||| 
   -               -               - 
   |               |               | 
 Owner           Group           Others


 -rwSrwxrwx = SUID   -rwxrwSrwx = SGID   drwxrwxrwt = SVTX 
 


chown (new owner) (filename)        Changes file/directory owners 
chgrp (new group) (filename)        Changes file/directory groups

chown (new owner).(new group) (filename)        Do both !!!

umask                            Displays umask settings 
umask abc                        Changes users umask settings


where ( 7 - a = new file read permissions) 
      ( 7 - b = new file write permissions) 
      ( 7 - c = new file execute permissions)


eg umask 022 = new file permissions of 755 = read write and execute for owner 
                                             read ----- and execute for group 
                                             read ----- and execute for other

mrgpwd > file.txt                Creates a standard password file in file.txt
passwd                           Change current user password
pwdadm (username)                Change a users password
pwdck -t ALL                     Verifies the correctness of local authentication

lsgroup ALL                      Lists all groups on the system 
mkgroup (new group)              Creates a group 
chgroup (attribute) (group)      Change a group attribute 
rmgroup (group)                  Removes a group


-------------------------------------------------------------------------------- 
                                USERS 
--------------------------------------------------------------------------------


passwd -f                        Change current users gecos (user description) 
passwd -s                        Change current users shell


chfn (username)                  Changes users gecos 
chsh (username) (shell)          Changes users shell


env              Displays values of environment variables 
printenv


id               Displays current user's uid and gid details 
id (user)        Displays user uid and gid details


whoami           Displays current user details 
who am i         (or who -m)


who              Displays details of all users currently logged in. 
who -b           Displays system reboot time


uptime           Displays number of users logged in, time since last 
                 reboot, and the machine load averages.


lslicense                    Displays number of current user licensese 
chlicense -u (number)        Changes the number of user licenses


lsuser ALL                              Lists all users details 
lsuser (username)                       Lists details for user 
lsuser -a(attribute) (username or ALL)  Lists user attributes 
lsuser -a home ALL

mkuser -a(attributes) (newuser)         Add a new user

chuser (attributes) (user)              Change a user 
chuser login=false (user)               Lock a user account

rmuser -p (user)              Removes a user and all entries in security files
usrck -t ALL                  Checks all the user entires are okay.
fuser -u (logical volume)     Displays processes using the files in that LV

lsattr -D -l sys0 -a maxuproc        Displays max number of processes per user 
chdev -l sys0 -a maxuproc=(number)   Changes max number of processes per user


-------------------------------------------------------------------------------- 
                             REMOTE USERS 
--------------------------------------------------------------------------------


ruser -a -f (user)       Adds entry into /etc/ftpusers file 
ruser -a -p (host)       Adds entry into /etc/host.lpd file 
ruser -a -r (host)       Adds entry into /etc/hosts.equiv file


ruser -d -f (user)       Deletes entry in /etc/ftpusers file 
ruser -d -p (host)       Deletes entry in /etc/host.lpd file 
ruser -d -r (host)       Deletes entry in /etc/hosts.equiv file


ruser -s -F              Shows all entries in /etc/ftpusers file 
ruser -s -P              Shows all entries in /etc/host.lpd file 
ruser -s -R              Shows all entries in /etc/hosts.equiv file


ruser -X -F              Deletes all entries in /etc/ftpusers file 
ruser -X -P              Deletes all entries in /etc/host.lpd file 
ruser -X -R              Deletes all entries in /etc/hosts.equiv file


-------------------------------------------------------------------------------- 
                                INITTAB 
--------------------------------------------------------------------------------


telinit S                Switches to single user mode. 
telinit 2                Switches to multi user mode. 
telinit q                Re-examines /etc/inittab


lsitab -a                Lists all entries in inittab 
lsitab (ident eg tty1)   Lists the tty1 entry in inittab


mkitab ("details")       Creates a new inittab entry 
chitab ("details")       Ammends an existing inittab entry

rmitab (ident eg tty1)   Removes an inittab entry.
chitab "tty1:2:respawn:/usr/bin/getty /dev/tty1"

-------------------------------------------------------------------------------- 
                                ODM 
--------------------------------------------------------------------------------

odmget -q "name=lp1" CuDv |more     Gets lp1 info from pre-defined database.
odmget -q "name-lp1" CuAt |more     Gets lp1 info from customised database.
odmdelete -o CuAt -q "name=lp1"     Deletes lp1 info from customised db.

odmget -q "name=lp1" CuAt > lp1.CuAt     Export ODM info to text file. 
odmadd < lp1.CuAt                        Import ODM info from text file.


-------------------------------------------------------------------------------- 
                             ERROR LOGGING 
--------------------------------------------------------------------------------


/usr/lib/errdemon -l         Displays errorlog attributes. 
/usr/lib/errdemon            Starts error logging. 
/usr/lib/errstop             Stops error logging.


errpt                        Displays summary errorlog report. 
errpt -a                     Displays detailed errorlog report. 
errpt -j (identifier)        Displays singe errorlog report.

Note : errorlog classes are H=Hardware S=Software O=Information V=Undetermined

errclear (days)              Deletes all error classes in the errorlog. 
errclear -d (class) (days)   Deletes all error class entries in errlog.


Note : The errclear command will delete all entries older than the numbers of 
       days specified in the days paramenter. To delete ALL entries used 0.


errlogger "message up to 230 chrs" 
Enters an operator notifaction message into the errorlog.


-------------------------------------------------------------------------------- 
                      PERFORMANCE MONITORING 
--------------------------------------------------------------------------------


vmstat (drive) (interval) (count)         Reports virtual memory statistics. 
vmstat hdisk0 5 20


vmstat -s              Diplays number of paging events since system start. 
vmstat -f              Diplays number of forks since system start. 
vmstat -i              Diplays number of interupts by device since system start.


iostat (drive) (interval) (count)         Reports i/o and cpu statistics. 
iostat hdisk0 5 20


iostat -d (drive) (interval) (count)      Limits report to drive statistics. 
iostat -t (interval) (count)              Limits report to tty statistics.

sar -u -P ALL 10 10         Displays %usr %sys %wio %idle for all processors

-------------------------------------------------------------------------------- 
                                      DOS DISKETTES 
--------------------------------------------------------------------------------


dosdir                    Reads directory listing of a diskette 
dosdir (directory)        Reads directory listing of a named directory

dosread -D/dev/fd0 C41.TXT c41.txt        Gets C41.TXT from diskette drive fd0

dosread -D/dev/fd0 DIRECTORY/C41.TXT c41.txt 
(-D option can be dropped if using fd0)

doswrite -D/dev/fd0 (unixfile) (dosfile)        Writes a file to diskette
dosdel (dosfile)                                Deletes a dos file on diskette
dosformat                                       Formats the diskette

-------------------------------------------------------------------------------- 
                                      SENDMAIL 
--------------------------------------------------------------------------------


sendmail -bi       Creates new aliase db from /etc/aliase file. 
newaliases


sendmail -bp       Displays the contents of the mail queue 
mailq

sendmail -q        Processe the sendmail queue NOW

sendmail -bt -d0.4 < /dev/null 
Prints out sendmail version, compile defines and system information


refresh -s sendmail                Restart sendmail 
kill -l (sendmail PID)


-------------------------------------------------------------------------------- 
                               SP / PSSP 
--------------------------------------------------------------------------------

dsh (command)                Runs the command on all the nodes

Efence                       Diplays which node are currently fenced 
Efence (node number)         Fences the node

Eunfence (node number)       Unfences the node
Estart                       Starts the switch

spmon -q                 Starts SP monitor in gui 
spmon -d -G              Diag info, lists LED and switch info for all nodes 
spmon -L frame1/node3    Displays LED for node 3 in frame 1


spmon -p off frame1/node3    Powers off the node 
spmon -p on frame1/node3     Powers on the node

spled                        Diplays all the nodes LED's in a updating gui

s1term -w (frame number) (node number)  Opens serial terminal (read and write) 
s1term (frame number) (node number)     Opens serial terminal (read only)

Example :-

s1term 1 1      Opens a serial terminal to console port on frame 1 node 1 
                which is read only. When rebooting a node use read only.


splstdata -e    Lists site environment database information 
          -d    Displays df command from each node 
          -n    Lists node configuration 
          -h    Diplays lscfg command from each node 
          -s    Lists switch node information 
          -b    Lists boot/installation information 
          -a    Lists LAN database information 
          -i    Displays netstat -in command from each node


MPIO (AIX 5.3 Default)
Check the paths and Multipathing (if not using MPIO) with datapath (or pcmpath) query adapter (or device)
The syntax to take paths offline for sddpcm is :
pcmpath set device M path N offline

where as M and N are the device number and path number for pcmpath query device output shown above for example for hdisk83
pcmpath set device 83 path 2 offline  to take path2 offline

MKPATH:
-------
   1. To define and configure an already defined path between scsi0 and the hdisk1 device at SCSI ID 5 and LUN 0 (i.e., connection 5,0), enter:

      mkpath -l hdisk1 -p scsi0 -w 5,0

      The system displays a message similar to the following:

      path available

   2. To configure an already defined path from 'fscsi0' to fiber channel disk 'hdisk1', the command would be:

      mkpath -l hdisk1 -p fscsi0

      The message would look similar to:

      path available

   3. To only add to the Customized Paths object class a path definition between scsi0 and the hdisk1 disk device at SCSI ID 5 and LUN 0, enter:

      mkpath -d -l hdisk1 -p scsi0 -w 5,0

      The system displays a message similar to the following:

      path defined

RMPATH:
-------
   1. To unconfigure the path from scsi0 to hdisk1 at connection 5,0, type:

      rmpath -l hdisk1 -p scsi0 -w "5,0"

      The message generated would be similar to:

      path defined

   2. To unconfigure all paths from scsi0 to hdisk1, type:

      rmpath -l hdisk1 -p scsi0

      If all paths were successfully unconfigured, the message generated would be similar to:

      paths defined

      However, if only some of the paths were successfully unconfigured, the message would be similar to:

      some paths defined

   3. To undefine the path definition between scsi0 and hdisk1 at connection 5,0, type:

      rmpath -d -l hdisk1 -p scsi0 -w "5,0"

      The message generated would be similar to the following:

      path deleted

   4. To unconfigure all paths from scsi0 to hdisk1, type:

      rmpath -d -l hdisk1 -p scsi0

      The message generated would be similar to:

      paths deleted

CHPATH:
-------
To disable the paths between scsi0 and the hdisk1 disk device, enter:

chpath -l hdisk1 -p scsi0 -s disable

The system displays a message similar to one of the following:

paths disabled

or

some paths enabled

The first message indicates that all PATH_AVAILABLE paths from scsi0 to hdisk1 have been successfully enabled. The second message indicates that only some of the PATH_AVAILABLE paths from scsi0 to hdisk1 have been successfully disabled.

LSPATH:
-------
   1. To display the status of all paths to hdisk1 with column headers, enter:

      lspath -H -l hdisk1

      The system will display a message similar to the following:

      status    device   parent
      enabled   hdisk1   scsi0
      disabled  hdisk1   scsi1
      missing   hdisk1   scsi2

   2. To display, without column headers, the set of paths whose operational status is disabled, enter:

      lspath -s disabled

      The system will display a message similar to the following:

      disabled  hdisk1   scsi1
      disabled  hdisk2   scsi1
      disabled  hdisk23  scsi8
      disabled  hdisk25  scsi8

   3. To display the set of paths whose operational status is failed, enter:

      lspath -s failed

      The system will display a message similar to the following:

      failed  hdisk1   scsi1
      failed  hdisk2   scsi1
      failed  hdisk23  scsi8
      failed  hdisk25  scsi8

   4. To display in a user-specified format, without column headers, the set of paths to hdisk1 whose path status is available enter:

      lspath -l hdisk1 -s available -F"connection:parent:path_status:status"

      The system will display a message similar to the following:

      5,0:scsi0:available:enabled
      6,0:scsi1:available:disabled

      Note that this output shows both the path status and the operational status of the device. The path status simply indicates whether the path is configured or not. The operational status indicates how the path is being used with respect to path selection processing in the device driver. Only paths with a path status of available also have an operational status. If a path is not currently configured into the device driver, it does not have an operational status.

Examples of displaying path attributes:

   1. If the target device is a SCSI disk, to display all attributes for the path to parent scsi0 at connection 5,0, use the command:

      lspath -AHE -l hdisk10 -p scsi0 -w "5,0"

      The system will display a message similar to the following:

      attribute  value  description                       user_settable
      weight     1      Order of path failover selection  true



SCRIPTS TO USE IN /USR/LOCAL/SCRIPTS
DB2(root)
[/usr/local/scripts]# cat errclear.ksh
#!/bin/ksh
errclear -j 72206E77 0

DB2(root)
[/usr/local/scripts]# cat errcopy_clear.ksh
#!/bin/ksh
thedate=$(date +%y%m%d%HH%MM)
errpt > /tmp/errpt
errpt -a >> /tmp/errpt
cp /tmp/errpt /tmp/errpt.$thedate
errclear 0
cat /dev/null > /tmp/monitor_log
cat /dev/null > /tmp/monitor_log_1
exit 0


AIX FIND FILESYSTEM ONLY
find / -xdev -size +200 -exec ls -l {} ';'






 source- online

No comments:

Post a Comment