Sunday, December 11, 2011

Network Related commands in AIX


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


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

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


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


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


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


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


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


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


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

Important 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 stdoutand 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.

Device Management in AIX


In order to attach peripherals such as terminals and printers to an AIX system, we must tell AIX the characteristics of these devices so that the operating system can send the correct signals to the adapter to which the device is connected. A number of pieces of hardware and software must interact correctly for the device to function correctly. 

1) Physical Devices -
Actual hardware that is connected in some way to the system.
2) Ports -
The physical connectors/adapters in the system where physical devices are attached. Most ports are programmable by the system software to allow attachment of many different types of devices.
3) Device Drivers -
Software in the kernel that controls the activity on a port and the format of the data that is sent to the device.
Eg: /dev/hdisk0 = device driver of hard disk 0
4) Logical Devices -
Software interfaces (special files) that present a means of accessing a physical device to the users and application programs. Data read from logical devices will be read from the appropriate device driver.
Eg: /dev/datalv = logical volume for data
5) /dev -
The directory which contains all of the logical devices that can be directly accessed by the user. (Some of the logical devices defined are only referenced in the ODM customized database and cannot be accessed by users.) 

Listing of /dev directory
#ls -l /dev

The ls -l command allows you to see the type of a file. A special file (in the /dev directory) will be indicated by a b in the first column for a block device or a c for a character device. 
= Block device is a structured random access device. Buffering is used to provide a
block-at-a-time method of access. Usually only disk file systems. 
Eg: cd0 CD-ROM
hdisk0 Physical Volume
= Character (raw) device is a sequential, stream-oriented device which provides no buffering. 
Eg: console, lft, tty0 Terminal
rhdisk0 Physical Volume
Most block devices also have an equivalent character device. For example, /dev/hd1 provides buffered access to a logical volume whereas /dev/rhd1 provides raw access to the same logical volume.Normally the fifth field contains a numeric value indicating the number of bytes in the file. Fordevices, it shows the major and minor device numbers. The device rmt0 shown in the listing has a major device number of 22 and a minor device number of 1. This indicates that the code to handle major device 22 must already be in the kernel, and it must handle device number 1 correctly. Clearly, the major number refers to the software section of code in thekernel which handles that type of device, and the minor number to theparticular device of that type or the operation mode of a device of that type. 

ODM - Object Data Manager

Device Configuration Database

1) Pre-Defined Configuration Databse
2) Customized Configuration Databcse

The predefined and customized databases store information about all of the logical devices in the system and their attributes managed by the ODM (Object Data Manager).

The predefined database contains configuration data for all possible devices supported by the system. The SMIT menus have options to install non-supported drivers. The contents of the predefined database is largely defined at installation time, ensuring that you always have support for devices in your system.

The customized database contains configuration data for all currently defined and configured (available) devices.
cfgmgr
The Configuration Manager is a program that automatically configures devices on your system during system boot and run time. The Configuration Manager uses the information from the predefined and customized databases during this process, and updates the customized database afterwards.

List all supported Devices 
PdDv = pre-defined Database
#lsdev -P -H
or
smit devices -> List Devices -> List All Supported Devices
Devices are classified by Class, Type and Subclass where Class indicates what the device does, Type indicates what model it is and Subclass indicates how it can be attached to the system.To find out what devices are listed in the predefined database, use the SMIT option List All Supported Deviceswhich runs the command lsdev -P. To find out the attributes of a predefined device, use the SMIT option Show Characteristics of a Supported Device which runs the command lsattr -D
The -P option pulls information from the predefined database in the ODM.
The -H option shows the headers for the output.
The -c option specifies the class of device.

List all Defined Devices
#lsdev -C -H

The devices that have been customized in the system are described in the ODM
customized database. Each device has a logical device name, a status, a location and various attributes.The lsdev -CH command provides information on the resource name, its status (or state), the address or location, and a brief description of all devices in the customized database.
Available: The device is ready and can be used
Defined: The device is unavailable
Devices may appear in a defined state after a restart. If this is the case, it may be due to the fact that the device is powered off or the fact that the device no longer exists on the system.
Devices with a location code are physical devices. Devices without a location code are logical devices.
#lsattr -EH -l sys0
The lsattr -E -l [resource name] command provides detailed information on the effective attributes currently configured for specified devices. In the example, it provides configuration information on the system itself.
The -C option for lsdev pulls the customized information from the ODM.
The -E option for lsattr shows the effective attributes.
The -l option for both commands is the logical device name.
The -c option for both commands is the class of device.
The -a attribute option for the lsattr command displays information for aspecific attribute.
Eg: #lsattr -E -l sys0 -a realmem
lscfg
Another command that can be used to list information about devices found in the ODM customized database is lscfg -v. The listing is sorted by parent, child and device location. Specific hardware information about devices will be listed such as EC level, FRU number, part number, and so forth. The output also displays the model architecture and bus type.
DEVICE STATES
The Most Common Device States are:-
Undefined - 
The device is a supported device but is not configured. It does not residein the customized database.
Defined - 
The device has been added to the customized database. It has been allocated a logical device name, a location code and attributes have been assigned to it. But, it is still unavailable for use.
Available - 
The device resides in the customized database. The device is fully configured and is ready for use.
When a device is first identified, it is configured and put into the Availablestate. If a device that has been configured in the past is powered off and the machine is rebooted, the device will appear in the Defined state. This indicates that the system knows it is supposed to be there, but because it was not powered on, it cannot be used. You can control the device states by using smit or the commands mkdev and rmdev.
To put a defined tape into an available state , in the smit devices area, use Configure a Defined Tape Device or #mkdev -l rmt0
To move an available tape device to defined , In the smit devices area, use Remove a Tape Device and set Delete from Database to no or #rmdev -l rmt0
To permanently remove an available or define tape device , In the smit devices area, use Remove a Tape Device and set Delete from Database to yes or #rmdev -dl rmt0
Remember, most Defined devices are the result of not powering on the device before booting. Or, it could be the device was physically removed, but you never ran rmdev -dl xxxx to remove the device from the ODM.