Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Monday 20 January 2014

Important things you should not miss!

To apply a TL while you are doing clonning

# alt_disk_copy -I acNgXY -P all -b update_all -l /fixpackfs/AIX_fix_packs/5300-08-10-1015 -d hdisk1

smitty alt_mksysb                                                           To run an alternate mksysb
smitty alt_clone                                                                               To run an alternate rootvg on disk

# alt_disk_copy -d hdisk1                                   To clone a rootvg on hdisk1
# alt_disk_copy -e /etc/exclude.rootvg -d hdisk1   To clone a rootvg on hdisk1 with exclude some of the files
# alt_rootvg_op -X altinst_rootvg                           To de-clone a rootvg
# alt_rootvg_op -q -d hdisk0                                To determine the boot disk for a volume group with multiple PV
# alt_rootvg_op -v alt_disk_530 -d hdisk2  To modify an alt_disk_install volume group name
# alt_rootvg_op -W -d hdisk0                               To "wake up" an original rootvg after booting from the new alternate disk
# alt_rootvg_op -S -t                                           To "put to sleep" a volume group that had experienced a "wake-up"
# alt_rootvg_op -d "hdisk3 hdisk4" -b update_all -l /updates           To update the alternate rootvg to the latest fileset levels                                                     available in /updates and install them into the alternate root volume group

To create a bff image
# gencopy -X -b "-qv" -d /fixpackfs/AIX_fix_packs/5300-09-00-0846  -t /usr/sys/inst.images -f File 2>&1
OR
smitty bffcreate

# lslpp –l                                                           To see what maintenance level your filesets
# lslpp –f                                                           To list the individual files that are installed with a particular fileset
# lslpp -h bos.sysmgt.trace                                 To list the installation and update history of filesets
# instfix -T -d /dev/cd0                                        To list fixes that are on a CD-ROM
# instfix -ik IY73748                                            To determine if APAR IX75893 is installed
# instfix -aik IY73748                                          To examine information about APAR IX75893 and what it does
# instfix -i | grep ML                                            To list what maintenance levels have been installed
# instfix -k IY73748 -d /dev/cd0                            To install APAR IY73748 from /dev/cd0

smitty show_apar_stat                                       Show the apar statistic                                      
smitty update_by_fix.                                         To install the fixes using SMIT
smitty update_all                                               To install all new fixes that are available from IBM

smitty assist                                                     To call the Configuration Assistant
smitty alt_install                                                            To create alternate installation disk
smitty alt_clone                                                 To clone your rootvg to a new disk
smitty alt_mksysb                                             To create the alternate mksysb system


# lppchk -c X11.adt.include                                 Check to ensure all fileset are installed correctly
           
# lppchk -l X11.adt.include                                  Verifies the symbolic link for filesets                                                       
# lppchk –v                                                        How to verify if all filesets are correctly installed
# mkitab "xcmd:2:respawn:find / -type f > /dev/null 2>&1"            Add a record named xcmd on the /etc/inittab
# lsitab xcmd                                                     Show the new record with the lsitab
# rmitab xcmd                                                   To delete this record from the /etc/inittab file
# chitab "xcmd:2:once:find / -type f > /dev/null 2>&1"       Change the action field on the record xcmd from respawn to once

# bootlist -m normal –o                                       To display a boot list
# bootlist -m normal cd0 hdisk0                           To make changes to your normal boot list
# bootlist -m normal -f filename                           To make changes to your normal boot list using file

# cat /etc/.init.state                                            Identifying the current run level

# odmget -q "type LIKE lv*" PdDv                        To interrogate ODM PdDv class about all objects
# odmget lpp|head -30                                        To interrogate the lpp class

Configuration Commands

# mknfs –N                                                        To start the NFS daemons immediately
#startsrc -g nfs                                                  System Resource Controller to start

smitty mknfsexp                                                            To export the directory
smitty rmnfsexp                                                 Un-export an NFS directory
smitty mknfsmnt                                                To establish predefined mounts through SMIT
smitty chnfsexp                                                 Changing an exported file system

# showmount -e                                                 It shows what is exported by current server
# showmount -e servername                                It shows what is exported by servername
# /usr/sbin/exportfs –a                                        Tells the kernel to reread the exportfs file, that have edited            
# exportfs -i /dirname                                          Exporting an NFS directory temporarily
# exportfs -u /dirname                                         Un-export the file system on the server
# umount /backup                                              To unmount an explicitly or automatically mounted NFS

# cat /etc/netsvc.conf                                         The default hostname resolution order specification

smit mkroute                                                     To add a route to the private network through the gateway
smit mktcpip                                                     To change or set IP addresses

# lsdev -Cc if                                                      To identify network interfaces on your server
# ifconfig –a                                                       To identify all network interfaces configured on your server
# ifconfig Interface                                              To get information about one specific network interface
# ifconfig tr0 up                                                  To activate a network interface using ifconfig
# ifconfig tr0 10.1.2.3 netmask 255.255.255.0 up              To activate a network interface and assign IP and netmask
# ifconfig Interface down                         To deactivate an interface
# ifconfig tr0 delete                                             To delete the network address from tr0
# ifconfig tr0 detach                                            To remove the interface tr0 from the network interface list
# ifconfig tr0 10.1.2.3 mask 255.255.255.0 alias                To bind the IP address of 10.1.2.3 to tr0 as a alias
# ifconfig tr0 10.1.2.3 mask 255.255.255.0 delete  When this alias is no longer required, you can remove it
# ifconfig en0 mtu 2000                                       To change the MTU size of tr1

Adding network adapter
# lscfg |grep -i adapter                                        network adapters on your system
# lsdev -Cc if                                                      interfaces are already on the system
Shut down and power off the system
Physically install the new network adapter
Power on the system in normal mode
# cfgmgr

Removing network adapter
# ifconfig Interface down                         Deactivate all network interface definitions for the network adapter
# ifconfig Interface detach                                   Remove (detach) all network interface definitions
# rmdev -l Interface –d                                        Delete the network interface definitions
# rmdev -l Adapter –d                                         Delete the network adapter definition
# shutdown  -F now                                            Shutdown the system
Physically remove the network adapter
Power on the system

Smitty chgenet                                                  To change the media speed for an Ethernet adapter

# pg /etc/swapspaces                                        All paging related information is listed in this file
# lsps –a                                                           To display all info about paging space
# lsps –s                                                           To see the total paging space used by system
# chps -s 3 hd6                                                  To increase the size of hd6
# chps -d 1 hd6                                                  To decrease the size of hd6
# migratepv -l hd6 hdisk0 hdisk1                          To move the default (hd6) paging space from hdisk0 to hdisk1
# swapoff DeviceName                                        To deactivate paging space
# swapon DeviceName                                       To activate the paging space
# rmps paging03                                                To removed paging space

Reducing the size of hd6 paging space: this is applicable only on below version 5L
# mkps -a -n -s 30 rootvg hdisk0                          Create a temporary paging space on rootvg
# chps -a n hd6                                                  to deactivate the hd6 paging spaces

Change the paging space entry in the /sbin/rc.boot from swapon /dev/hd6 to swapon /dev/paging00

# sysdumpdev –l                                                to check the primary dump device designation
# sysdumpdev -P -p /dev/paging00                       change it to some other paging space
# bosboot -d /dev/hdisk0 –a                                Create a bootable image with the bosboot command
# shutdown –r                                                    shutdown the operating system and reboot
# rmps hd6                                                        After the system reboots, remove the hd6 paging space
# mklv -t paging -y hd6 rootvg 30             Create a new paging space LV  of the size 120 MB for the hd6
# sysdumpdev -P -p /dev/hd6                              Change the primary dump device designation

Change the paging space entry in the /sbin/rc.boot file from swapon /dev/paging00 to swapon /dev/hd6

# bosboot -d /dev/hdisk0 –a                                Create a bootable image with the bosboot command
# chps -a y hd6                                                  to make the new hd6 paging space automatically activate when reboot
# shutdown –r                                                    Reboot the system
# rmps paging00                                                After the system reboots, remove the temporary paging space

# lsdev -P –H                                                     To list all devices in the Predefined Devices object class
# lsdev -C –H                                                     To list all the devices in the Customized Devices object class
# lsdev -C -c adapter -S a                                   To list the adapters that are in the Available state
# lsdev -P -r class                                              To list all the classes of supported devices on your system
# lsdev -C -c disk                                               To show the disk drives on your system

# lscfg                                                               To display the system configuration
# lscfg -v -p -l rmt0                                             To display the VPD for about rmt0
# lscfg -v -p -l ent2                                              To obtain the physical location and firmware version of eth0

# lsattr -l rmt0 –D                                               To list the default attribute values for the tape device rmt0
# lsattr -l rmt0 -E                                                To list the current attribute values for the tape device rmt0
# lsattr -l scsi0 -a bus_intr_lvl –E                         To list the current value of the bus_intr_lvl attribute
# lsattr -l scsi0 -a bus_intr_lvl –D             To list the default value of the bus_intr_lvl attribute

# chdev -l ent0 -a media_speed=100_Full_Duplex -P         Change the media_speed forcefully to 100_Full_Duplex
# chdev -l ent0 -a media_speed=Auto_Negotiation            Change to auto negotiate for speed duplex

# mkdev -l rmt0                                                  To make the predefined rmt0 tape device available to use

# rmdev -l rmt0                                                   To make available rmt0 to defined state                                       
# rmdev -dl rmt0                                     To unload the device configuration from the ODM
# chdev -l rmt0 -a attr=value                                To change the attribute of the rmt0 device
                                               
smitty devices                                                   Smit screen to configure devices
smitty chdev                                                      Smit screen to change device attribute
smitty rmdev                                                      Smit screen to remove the device configuration from ODM

# lssrc    -a                                                        List all services and their status
# startsrc -g                                                       Start network service group
# startsrc -s                                                       Start network service subsystem
# stopsrc  -g                                                      Stop network service group

# /usr/lib/errdemon                                             To start the error daemon
# /usr/lib/errdemon –l                                          To determine the path to your system's error log file
# /usr/lib/errdemon -s 2000000                            To change the maximum size of the error log file
# /usr/lib/errdemon -B 16384                               To change the size of the error log device driver's

# errpt                                                               To display a complete summary report of the errors
# errpt –a                                                          To display a detailed report of all the errors encountered
# errpt -a -j E19E094F                                        To display a detailed report of all errors logged error identifier E19E094F
# errpt -a -s 0828093001                         Displaying the errors by time reference
# errlogger Testing use of errlogger command       To log operator messages to the system error log
# errclear 0                                                        Deletes all entries from the error log
# errclear -d S 0                                                 To delete all entries in the error log classified as software errors
# errinstall                                                         Installs messages in the error logging message sets
# errupdate                                                        Updates the Error Record Template repository

# bindprocessor –q                                             Query the available processors
# smtctl -m off -w now                                        To turn off simultaneous multithreading immediately
# smtctl -m on -w boot                                        To turn on simultaneous multithreading after the next reboot

# chdev -l hdisk7 -a pv=yes                                 Assigning a PVID to a physical volume
# chdev -l hdisk7 -a pv=clear                               Clears the PVID from the physical volume

Reconfiguring a system from a 32-bit to a 64-bit kernel
To identify the type of system hardware you have, either 32-bit or 64-bit, execute the bootinfo -ycommand. If the command returns a 32, you cannot use the 64-bit kernel.64-bit kernel information stored in the /usr/lib/boot.
unix_mp 32-bit kernel for multiprocessor systems
unix_64 64-bit kernel for 64-bit processor systems

# ln -sf /usr/lib/boot/unix_64 /unix
# ln -sf /usr/lib/boot/unix_64 /usr/lib/boot/unix
# bosboot -ad /dev/ipldevice
bosboot: Boot image is 23137 512 byte blocks.
# shutdown -r
# ls -al /unix
lrwxrwxrwx 1 root system 21 Nov 11 11:30 /unix -> /usr/lib/boot/unix_64

Logical Volume Management Commands

# lspv hdisk2                                                     To display detailed information about a physical volume
# lspv -l hdisk0                                                   To display the names of all the lv that have at least one partition on pv
# lspv -p hdisk0                                                  To display the allocation of PPs to logical volumes
# lspv -M hdisk0|more                                         To display the layout of a physical volume
# chpv -an hdisk2                                               Disabled the ability to allocate new free physical partitions
# chpv -ay hdisk2                                               To turn on the allocation permission
# chpv -vr hdisk3                                                Makes hdisk3 unavailable
# chpv -va hdisk3                                               Makes hdisk3 available again
# chpv -c hdisk1                                     To clear the boot record located on physical volume hdisk1
# chpv -hy hdisk3                                               To define hdisk3 as a hot spare
#chpv -hn hdisk3                                                To remove hdisk3 from the hot spare pool
# migratepv hdisk1 hdisk5                                   Migrates the data from hdisk1 to hdisk5
# migratelp testlv/1/2 hdisk5/123                         Migrates the data from the second copy of the logical partition number 1                                                                of logical volume to hdisk5 on physical partition 123.
# lquerypv -M hdisk0                                          To find the LTG size for a physical disk

# lsvg                                                                To display all volume groups known to a system
# lsvg –o                                                           To display all active volume groups
# mkvg -y vg1 -s64 -V99 hdisk4                           Creating an original volume group
# mkvg -B -y vg2 -s 128 -f -n -V 101 hdisk6           Creating a big volume group
# mkvg -S -y testvg -s 1 -f hdisk3 hdisk4 hdisk5    Creating a scalable volume group
# lsvg testvg                                                      To display details about a specific volume group
# lsvg -l rootvg                                                    To display logical volumes contained in a volume group
# lsvg -p test1vg                                     To display all physical volumes contained in a volume group
# chvg -ay newvg                                                Testvg to be activated automatically the next time the system is restarted
# chvg -an newvg                                                Not be activated automatically next time the system is restarted
# chvg -Qn testvg                                               To turn off the quorum
# chvg -Qy testvg                                               To turn on the quorum
# chvg -hn test1vg                                              Changes the hot spare policy of the volume group
# chvg -sy test1vg                                              Changing synchronization policy of a volume group
# chvg -hy test1vg                                              Changes the hot spare policy of the volume group
# chvg -hn test1vg                                              Changes the hot spare policy of the volume group to no
# chvg -t 16 testvg                                              Change the maximum number of physical partitions per physical volume
# chvg -G db2vg                                     Changing a volume group format
# chvg -L 128 testvg                                           Change the LTG size for the testvg volume group
# chvg -P 2048 testvg                                         Changing the maximum number of physical partitions
# chvg -v 4096 testvg                                          Changing the maximum number of logical volumes
# chvg –u                                                          Remove the lock of volume group
# extendvg test1vg hdisk7                                   Extend a volume group with hdisk7
# extendvg -f test1vg hdisk4                                Extend a volume group with hdisk4 forcefully
# reducevg testvg hdisk7                         Reduce volume group with hdisk7
# reducevg -d testvg hdisk7                                 Reduce volume group with hdisk7 forcefully
# synclvodm testvg                                             To synchronize ODM to contain the latest LVM information for VG
# exportvg testvg                                                To export the volume group testvg
# importvg -y testvg hdisk7                                  Import volume group testvg using hdisk7
# varyoffvg testvg                                                Varyoff volume group
# varyonvg testvg                                                Varyon volume group
# syncvg -p hdisk4 hdisk5                                   To synchronize the copies located on pv hdisk4 and hdisk5
# syncvg -v testvg                                               To synchronize the all physical partitions from volume group testvg
# mirrorvg rootvg                                     To mirror a rootvg on another disk

Mirroring a rootvg
# bootinfo –s hdisk1                                           To check the size of disk
# bootinfo –s hdisk0                                           To check the size of disk
# extendvg rootvg hdisk1                         To add a new disk to rootvg
# Mirrorvg rootvg hdisk1                                      To mirror a rootvg on hdisk1
# bosboot –ad /dev/hdisk1                                  To create boot logical volume on hdisk1
# bootlist –m normal hdisk0 hdisk1                      To set the bootlist


# splitvg -y newvg -c 1 test1vg                             To split a volume group
# joinvg test1vg                                                  To rejoin the two copies of the volume group test1vg

# lslv lv1                                                            To display details about a specific logical volume
# lslv -l lv1                                                         Displays a LV on which disk and In Band policies
# lslv -m lv1                                                       To display LPs and PPs number
# mklv -y lv3 -t jfs2 -a im test1vg 10 hdisk5           Create a logical volume
# extendlv lv05 3                                                Extend a logical volume with 3 PP                                  
# rmlv lv7                                                           Remove a logical volume
# rmlv -f  lv1                                                       Remove a logical volume without confirming
# chlv -x 1000 lv1                                               Sets the maximum number of logical partitions allocated to LV

# cplv -v dumpvg -y lv8 lv1                                   To copy LV lv1 to the dumpvg volume group under the name of lv8
# mklvcopy -k lv1 3 hdisk7 &                               To create and synchronize extra copies of logical partitions
# splitlvcopy -y copylv testlv 2                            
# rmlvcopy testlv 2 hdisk6