Tuesday, October 13, 2009

Network Related commands in AIX


AIX Network Related commands

host 193.9.200.1  Resolves ip to host name (from /etc/hosts file)

host ibm                 Resolve ibm to ip address (from /etc/hosts file)

hostname ibm      To change the host name to ibm

entstat en0         To the status of ethernet device en0

entstat -d en0     To list the detailed status of device en0

no -a                  To list all net configurable attributes and their values

no -d thewall      To change thewall parameter to its default value

no -o ipforwarding=1   To make the machine as router in tcpip networks

traceroute ibm            To trace the route to ibm

ping ibm                     To tcp ping to the machine ibm

ifconfig -a                  To show the status of all network interfaces

ifconfig en0                To show the status of en0

ifconfig en0 up           Turns on network card en0

ifconfig en0 down       Turns off network card en0

ifconfig en0 detach     Removes en0 card from the network interface list

ifconfig en0 inet 194.35.52.1 netmask 255.255.255.0 up     configure en0 and starts immediately

mktcpip -h ibm -a 10.0.2.40 -m 255.255.255.0 -i en0  assign hostname as ibm, IP as 10.0.2.40 subnetmask 255.255.255.0 to en0 interface

ifconfig en0 alias 195.60.60.1   Create alias ip address for en0

route add 0 192.100.13.7         
To make 192.100.13.7 as default gateway for entire network

route add 192.100.12.0 192.100.13.7   To make 13.7 as gateway for 12.0 network

route -f                To clear the gateway table

chdev -l inet0 -a hostname=ibm    To change the host name to ibm permanently

netstat -a                To show the state of all sockets

netstat -c                 To show the network buffers cache

netstat -D                To show the net drops of packets

netstat -i               To display interface statistics

netstat -r               To show the routing table

netstat -rn             To show routing table (ip will be given instead of host names)

netstat -s                 To show the statistics of the protocols

netstat -s -p <>      To show the statistics of respective protocols

********


Installation specific commands in AIX


AIX Installation Specific commands

lslpp -l                              To see the details of installed file sets

lslpp -ha bos.net.*             To list the installation history of all file set in bos.net packages

lslpp -f bos.rte                   To list the files in the bos.rte package

lslpp -w /etc/hosts
           To list the file set which contain /etc/hosts file (parent fileset)

lslpp -p bos.net.nfs.server  To list the pre requisites for bos.net.nfs.server file set 

lslpp -d                To show dependancies of fileset
         
installp -L -d /dev/rmt0.1  To list the installable products on the device rmt0

installp -aX -d /dev/rmt0.1 bos.net   To install all filesets within bos.net and expands file system if it requires

installp -u bos.net       To remove bos.net

installp -r                      To reject the applied software

installp -c -f                 
To commit the applied fileset

installp -C                     To cleanup an incomplete installation

lppchk -c                      To check the fileset items and verifies that the checksum and filesize are consistent with SWVPD

lppchk -v                      verify that all filesets have required requisites and are completely installed

instfix -k IX9999 -d /dev/rmt0.1 To install the file set associated with fix IX9999 from rmt0

instfix -ik IX9999         To verify fix IX9999 installed


************

Console Emulation commands in AIX


AIX Console emulation commands

lscons                  To list the current console

lscons -b              To list the console at next boot

chcons /dev/tty3 To change the console to tty3

chcons -a login=enable /dev/tty3  Redirect console to tty3 and provide login prompt

swcons /dev/tty3     To change system console to tty3 temporarily


************

Device Related Commands in AIX


AIX Device Related commands


cfgmgr                 To configure devices and installs device software in system

cfgmgr -l vscsi0     To configure the components connected to the vscsi0 interface

lscfg                          To display config, diagnostics and vital product definition info

lscfg -l mem0         Display info about device mem0

lscfg -l ent*
            Display info about all Ethernet cards

lscfg -v
                   Display vpd

lscfg -v -l hdisk0       Display vpd of hdisk0

mkdev -l rmt0         To change device rmt0 from defined state to available state

lsdev -P                  To lists all supported devices

lsdev -P -c disk        To list all supported disks

lsdev -P -r class        To display supported class

lsdev -P -r subclass  To display all sub class

lsdev -C                  To lists all configured devices

lsdev -C -l mem0     To display the properties of mem0

chdev -l sys0 -a maxproc=100   To change default maxproc value to 100/user

chdev -l rmt0 -a blocksize=512  To change the block size to 512

chdev -l rmt0 -a ret=no            To avoid tape retension

rmdev -l rmt0                           To remove the device rmt0

rmdev -dl rmt0                         To remove the device totally from database

rmdev -l rmt0 -S                          
To change the state of the device stopped

lsparent -C -k rs232                 To display possible parent devices which accept rs232 devices

lsparent -C -l hdisk0                 To display parent devices which accept child device hdisk0

lsattr -Dl rmt0                         To see the default values of the device rmt0

lsattr -El rmt0                         To see the current values of the device rmt0

lsattr -El tty0 -a login -R           To see all possible values of the login attribute of tty0

lsconn -p scsi0                        To list all possible connection scsi0 can accept

lvlstmajor                               To list the available major numbers

mknod /dev/null c 2 2              Create null device with major (2) and minor (2) nos. (c - char device)


****************

System Dump commands in AIX


AIX System Dump commands

sysdumpdev -l           To list the current dump destination

sysdumpdev -L          List the details of the previous dump

sysdumpstart -p        Starts dump in the primary dump device

sysdumpstart -s        Starts dump in the secondary dump device

sysdumpdev -p /dev/lv00       To make lv00 as primary dump device tempararly

sysdumpdev -P -p /dev/lv00   To make lv00 as primary dump device permanently

sysdumpdev -s /dev/rmt0
     To make rmt0 as secondary dump device

sysdumpdev -z                      To determine a new system dump occurred


**************

Paging Space Commands in AIX

AIX Paging Space COMMANDS

lsps -a                      To list out all paging spaces

lsps hd6                   To display the details of the paging space hd6

chps -a y paging00    To turn on the paging space paging00 on next reboot

chps -a n paging00    To turn off the paging space paging00 on next reboot

chps -s4 paging00     To increase the size of the paging space in 4 LP blocks

mkps -a -n -s4 newvg   To create a paging space on VG newvg of 4 LP size (-s4) and activate it immediately (-n) and activate it at every restarts

rmps paging00               To remove the paging space paging00

swapon -a                     To invoke all entries in /etc/swapspaces file

swapon /dev/paging00
  To make available swap space paging00

swapoff /dev/paging00  To disable swap space paging00




***********


BLV commands in AIX


AIX Boot Logical Volume commands


Bootlist, Bosboot and Bootinfo commands in AIX


bootlist -m normal -o     To see the boot sequence in normal mode

bootlist -m service -o      To see the boot sequence in service mode

bootlist -m normal hdisk0 hdisk1        To change boot sequence to hdisk0, hdisk1 in normal mode

bootlist -m service cd0 rmt0 hdisk0    To change boot sequence to cd0,rmt0,hdisk0 in service mode

bosboot -a       To create Boot image on default boot logical volume on the hard disk, from where the system is booted.

bosboot -ad /dev/hdisk1                 To create boot image on specified PV hdisk1

mkboot -cd /dev/hdisk1
                  To clear the boot image from hdisk1 (as chpv -c hdisk1

bootinfo -b           To show the last boot device

bootinfo -e             
Check the machine can boot from tape

bootinfo -k             To check the type of boot (1=secure,2=service,3=normal)

bootinfo -K              To check whether the 32 or 64 bit kernel is active

bootinfo -m             To display machine model code


bootinfo -o hdisk0    To display the device location or disk device name of hdisk0 

bootinfo -p            To see the machine platform

bootinfo -r               To see the size of memory

bootinfo -s hdisk0   To see the size of hdisk0

bootinfo -P 0 -s hdisk0    To see the physical partition(PP) size of hdisk0

bootinfo -t              Specifies the type of boot

bootinfo -T           To see the machine type

bootinfo -y              To see whether the hardware in use is 32 bit or 64 bit



*****************

LV commands in AIX



AIX Logical Volume Commands

lslv -l lv00              Display info about LV lv00 by PV

lslv -p hdisk1           Display LV allocation map for hdisk1

chlv -t copy lv00    To change the lv00 to copy type

chlv -p r lv00
        To change the lv00 to readonly mode

rmlv testlv            To remove testlv

rmlv -f testlv         To remove testlv forcefully (without confirmation)

mklv -s n -c 3 testlv hdisk1   To make LV testlv with three copies on hdisk1

extendlv testlv 5                      To extend the LV silv with 5 LPs

mklvcopy -s n testlv 2 hdisk1     To mirror LV testlv on same PV with 2 copies

mklvcopy testlv 3 hdisk1 hdisk2
  To mirror LV testlv on hdisk1 and hdisk2 with 3 copies

rmlvcopy testlv 2 hdisk1            To remove one copy of LV testlv from hdisk1

mklv -t jfslog -y log00 newvg 2  To create a jfslog with name log00 on VG newvg with 2LPs


mklv -t boot -y hd5  rootvg 1      To create logical volume, type as boot with 1 LP (BLV)

logform /dev/log00                 To format jfslog volume log00


**************

PV commands in AIX


AIX Physical Volume commands


lspv                         show all PV's in the system and their status

lspv hdisk0              display status and characteristics of the PV hdisk0

lspv -p hdisk0          display PP usage of hdisk0 and their location

lspv -l hdisk0           To list all logical volumes on PV hdisk0 and their  distribution

chpv -v r hdisk1       make unavailable the PV (Used while removing PV without varyoffvg)

chpv -v a hdisk1      make PV available.(Open the PV)

chpv -c hdisk0        Clear the master boot record on PV hdisk0 (CAREFULLY..!!)

migratepv hdisk1 hdisk2  To move PPs from hdisk1 to hdisk2

migratepv -l newlv hdisk1 hdisk2   To migrate LV newlv from hdisk1 to hdisk2


**************

FS commands in AIX


AIX File System commands


lsfs                    Lists all filesystems in the /etc/filesystems entry

lsfs -a                To list all filesystems (default)

lsfs -q                List all filesystems with detailed info (shows size of FS and LV in it. so we can check wheather size of LV=size os FS)

lsfs -l                 Specify the output in list format

lsfs -c                 Specify the output in column format

lsfs -v jfs            Lists all jfs filesystems

chfs -a size=24576 /test        Change size of FS /test to 24576(blocks)x 512 bytes  (12 MB)

chfs -a size=+24576 /test     Add 24576(blocks)x512 byte  to FS /test


chfs -a size=+64M /test        Add 64 MB to /test

chfs -a size=10G /test           fix size of the FS /test to 10 GB

chfs -m /test /new                 Change the mount point from /test to /new

chfs -A /test                         To auto mount the filesystem test


chfs -d account /test              Remove account attribute of /test.(from /etc/filesystems file)

chfs -a splitcopy=/backup -a copy=2 /oracle
  This will mount the 2nd copy of mirrored filesystem oracle to /backup in read-only mode for backup purpose

crfs -v jfs2 -g newvg -a size=100M -m /test   Creates FS /test of type jfs in VG newvg of size 100 MB with default LV.

crfs -v jfs -d /dev/lv00 -m /test Create FS /test of type jfs on device /dev/lv00

rmfs /test            Deletes FS /test and associated LV

rmfs -r /test         Deletes FS /test its mount point and associated LV

defragfs /test      To defragment the file system /test

defragfs -q /test  Display the current defrag status of the file system

fsck -y n /dev/lv00  To check the filesystem associated to /dev/lv00 assuming response "yes"

fsck -p /dev/lv00    To restore superblock from backup superblock


*************


VG commands in AIX


AIX Volume Group COMMANDS

lsvg                      Display all VGs

lsvg -o                  Display all active VGs

lsvg rootvg            Display info about rootvg

lsvg  -l rootvg         Display info about all LVs in rootvg

lsvg -o |lsvg -il       Display info about all LVs in all VGs

lsvg  -p rootvg        Display info about all PVs in rootvg

mkvg  -s 8 hdisk1    Create VG with name vgxx on hdisk1 with partition size 8MB

mkvg -s 8 -y newvg hdisk1          Create VG with name newvg on hdisk1 with partition size 8MB

mkvg -s 4 -t 2 -y newvg hdisk1    Create sivg on hdisk1 with PP size 4 and no of partions 2 * 1016

chvg -a y newvg            To automatically activate newvg at startup

chvg -a n newvg            To deactivate the automatic activation at startup

chvg -t 2 newvg            To change maximum no. of PP / PV to 2032 on vg newvg i.e 2*1016 ( so max no. of hdisk in newvg is 16 as in this case in normalvg)

chvg -Qn newvg            To disable quorum on VG newvg

reorgvg  newvg             Reorganises PP allocation of  VG newvg

extendvg newvg hdisk3 hdisk4    Add PV hdisk3 and hdisk4 to VG newvg


exportvg newvg            Exports the VG newvg

importvg -V 44 -y newvg hdisk2    Import the hdisk2 with name  newvg, and assign major number 44

redcucevg newvg hdisk3        Remove PV hdisk3 from VG newvg

varyoffvg newvg            To deactviate VG newvg (after unmounting filesystems in newvg)

varyonvg newvg             To activate VG newvg

syncvg -v newvg            To sync the mirrored LV in the VG newvg

mirrorvg -S -m newvg hdisk2    To mirror LVs of newvg with hdisk2 (-m for exact mirror, -S for forbackground  mirror)

unmirrorvg newvg hdisk2    To remove the mirrored PV from the newvg


***********


Monday, October 12, 2009

Important AIX commands


USEFUL AIX COMMANDS


lsitab init : to display default
runlevel of an AIX system

cat /etc/.init.state
: to get current runlevel of an AIX system


lslpp : display installed softwares on AIX

/usr/lib/errdemon : to start error login ( errpt ) in AIX

procwait -v : wait for a process and display status

procsig : list all signal action defined by processes

chuser fsize=-1 : to give permissions to create files over 2GB for a user.(-1=no limit)

lppchk -l : to verify that the symbolic links assoiciated with a file set are correct as indicated in the SWVPD.

shutdown -F : fast shutdown AIX system

shutdown -Fr : fast reboot AIX system

shutdown -Fm : reboot an AIX system to maintenance mode

telinit 2 : reboot an AIX system to normal mode

teleinit q : read nittab file

oslevel -s : display the currently installed service pack level in AIX

find /apps -print | backup -i -v -f /dev/rmt0 : copy the contents of /apps to tape in AIX

who : display currently logged users

ln -sf /usr/lib/boot/unix_64 /unix
ln -sf /usr/lib/boot/unix_64 /usr/lib/boot/unix
bosboot -ad /dev/ipldevice
shutdown -Fr
: reconfigure an AIX system from a 32-bit kernel to a 64-bit kernal.

oslevel -rl 5300-06 : show which filesets still need to get new technology level 5300-06 after AIX upgradation

chnfs -n 100 -B : increase the number of system threads allowed to access NFS mounts to 100

./myscript > /tmp/myoutput 2>1 : run myscript and redirect stdout and stderr to /tmp/myoutput


installp -C : to cleanup improperly applied filesets ( interrupted)

lppchk -c : to verify all the filesets installed completely

lppchk -v : verify that the operating system(AIX) is in a consistent state after installing AIX technology level ( to verify all filesets are installed completely)

refresh -s inetd : to restart TCP/IP

chvg -Qn testvg : disable quorum in testvg

smit update_all : to apply system to latest technologic level from CD.

migratepv -l /dev/testlv hdisk1 hdisk2 : move (migrate) testlv from hdisk1 to hdisk2

migratepv hdisk1 hdisk2 : move all data from hdisk1 to hdisk2

lsfs -q /testfs : to check the size of /testfs and the LV mounted on it. i.e how much space required by the FS to reach as that to LV in it.

last    To list all the records in the /var/adm/wtmp file (all successful logins)




last shutdown         To show the time of previous shutdown of server.


last reboot    To show the time of previous reboot of server. 




uptime   To show how long the system has been up ( w -u )


oslevel                To list the operating system level


lslicense              To see the number of license


chlicense -u30          To change the fixed user license to 30


chlicense -f  on         To enable floating user license

lsmcode        To check system firmware version (sys0)

invscout        To get firmware of all peripheral devices. It will generate the output in /var/adm/invscout/invs.mrp containing the firmwares of all peripheral devices.

 





****************



Tuesday, October 6, 2009

Fix a corrupted BLV in AIX


FIX A CORRUPTED BOOT LOGICAL VOLUME IN AIX


Recreate BOOT LOGICAL VOLUME (BLV) in AIX


If a Boot Logical volume (BLV) is corrupted, a machine will not boot.
(Eg:bad block in a disk might cause a corrupted BLV)

To fix this situation, You must boot your machine in maintenance mode, from a CD or Tape. If a NIM has been setup for a machine, you can also boot the machine from a NIM master in maintenance mode.

The bootlists are set using the bootlist command or through the System Management Services Progam (SMS). pressing F1 will go to SMS Mode.

then change the bootlist for service(maintenance) mode as 1st device to CD ROM.

#bootlist -m service cd0 hdisk0 hdisk1

then start maintenance mode for system recovery,

Access rootvg,

access this volum group to start a shell,

then recreate BLV using bosboot command.

#bosboot -ad /dev/hdisk0

it's important that you do a proper shutdown, All changes need to be written from memory to disk.

#shutdown -Fr

Imp: bosboot command requires that boot logical volume hd5 exists. If you wan create a BLV ( may be it had been deleted by mistake ), do the following,

1. boot your machine in maintenance mode,
2. Create a new hd5 logical volume, one PP size, must be in rootvg,specify boot as logical volume type,

#mklv -y hd5 -t boot rootvg 1

3. Then run bosboot command as described.


If you have an HMC, then at the time of booting select boot as SMS in the properties of that partition.



*******



Thursday, October 1, 2009

Link Aggregation in AIX

LINK AGGREGATION IN AIX


Link Aggregation ( Network Bonding ) in AIX

Link aggregation means you can give one IP address to two network cards and connect to two different switches for redundancy purpose. In this only one network card will be active in one time, and when it got failed the other network card goes active and let us continue our work.

It is better to use through SMIT.

#smit

then goto

Devices > Communication > EtherChannel / IEEE 802.3ad Link Aggregation > Add An EtherChannel / Link Aggregation

here select the network card that you want to use, ie active.

Eg: select ent0

IMP : then select Mode as 8023ad

then select backup adapter for redundancy.(press F4 to show N/W adapters.)

Eg: ent1

press enter.

now ent0 and ent1 got bonded.

then automatically a virtual adapter will be created named ent2.

then put IP address and all to this virtual adapter.

#smit

Communications Applications and Services > TCP/IP > Minimum Configuration & Startup

here select ent2 ( new bonded virtual adapter )

put IP Address and all,

give start now option.

Now you are successfully completed Link aggregation and check whether it works or not by removing the 2nd cable to the network card and check ping, then put the 2nd cable and remove 1st cable. 2 - 3 drops normally occurs in my experience.


*******