aix foundation-basic commands+

36
1 AIX (Foundation)Basic Commands + Basic Commands: pwd (present/current working directory) cd .. (to go previous directory) cd (to go home directory) To List: ls -l (list/long list) ls -lr (list reverse) ls -lrt (list times based) ●ls -li (list inode values) ls -la (list hidden files) ls -ld (list directory) FILE MANIPULATION: Create Files touch (to create a file) ex: touch file1 Cat: ●cat (to view files) ex: cat > file1 (to print in a file) ex: cat >> file1 (to append text in a file) ex: ls -l > file1 (to save the listed text in a file) ex: ls l /tmp > file1 Copy, remove, move, and rename files: cp ex: cp file1 file2 (relative path) ex: cp /etc/passwd /tmp/test/passwd (or) nil[space] (absolute path)

Upload: manavalan-loganathan

Post on 24-Oct-2014

192 views

Category:

Documents


19 download

TRANSCRIPT

Page 1: AIX Foundation-Basic Commands+

1

AIX (Foundation)–Basic Commands +

Basic Commands:

●pwd (present/current working directory)

●cd .. (to go previous directory)

●cd (to go home directory)

To List:

●ls -l (list/long list)

●ls -lr (list reverse)

●ls -lrt (list times based)

●ls -li (list inode values)

●ls -la (list hidden files)

●ls -ld (list directory)

FILE MANIPULATION: Create Files

●touch (to create a file)

●ex: touch file1

Cat:

●cat (to view files)

●ex: cat > file1 (to print in a file)

●ex: cat >> file1 (to append text in a file)

●ex: ls -l > file1 (to save the listed text in a file)

●ex: ls –l /tmp > file1

Copy, remove, move, and rename files:

●cp

●ex: cp file1 file2 (relative path)

●ex: cp /etc/passwd /tmp/test/passwd (or) nil[space] (absolute path)

Page 2: AIX Foundation-Basic Commands+

2

●cp -p [p-preserve] (to copy with the same time of the file and ownership)

●ex: cp - /etc/passwd /tmp/test

●cp -p /etc/group . (. Represents the current working directory)

●rm <file>

●ex: mv file2 file3

DIRECTORY MANIPULATION: Create,copy,delete,move directories:

●mkdir (to create a directory)

●ex: mkdir /tmp/testdir

●ex: mkdir -p /tmp/testdir/dir2/dir3 [parent] (to create sub folders)

●ex: cp -rp [r-recursive, p-preservative] cp -rp dir1 dir2

●cp -rp dir/* /tmp/testdir (copy all files)

●mv dir1 dir2

●rmdir dir1 (remove empty directory)

●ex: rm -rf dir1 [force](to remove directory files and contents)

●ex: cat file1 |pg (to view page by page)

●pg file1

●ex: cat /etc/security/user |pg

●pg /etc/security/user

GREP: (To get particular string or pattern)

●ex: cat /etc/security/user |grep -i admin

●ex: grep -i admin /etc/security/user (to get exact word “admin”)

●ex: wc -l /etc/security/user (to get word count of the file)

HEAD,TAIL:

●ex: head -5 /etc/security/user (to list first 5 lines of the file)

●ex: tail -5 /etc/security/user (to list last 5 lines of the file)

●*By default 10 lines will be listed if not mentioned in specific like “-5”+

Page 3: AIX Foundation-Basic Commands+

3

Other Commands:

●bc (background calculator)

●who (to check logged user)

●uptime (to check the uptime of the server)

●who -b (to check the server boot time)

●hostname (to check the server name)

●id (to get the details of the user)

CHECK ML/TL WITH SERVICE PACK:

●oslevel -s [o/p = 5.3.0.0(Version) -04(TL) -25(AIX SP)

●oslevel -r [o/p = 5.3.0.0(Version) -04(TL)

BOOT INFO COMMANDS:

●bootinfo -r (to check RAM size in KB by default)

●bootinfo -K (to check the kernel version of the current os)

●bootinfo -y (to check hardware supported kernel)

●bootinfo -b (to check the last boot device through which the server was booted)

●bootinfo -s <diskname> (to check the HDD size in MB)

●bootinfo -p (to check platform in specific)

FILESET & PACKAGE INSTALLATION:

●ex: installp -a -d /dev/cd0 bos.net.nfs.server (a-apply mode, d-device location)

●ex: installp -a -c -d /dev/cd0 bos.net.nfs.server (c-commit mode_apply & commit mode

simultaneously)

●ex: installp -c bos.net.nfs.server (to apply commit mode later)

●ex: installp -r bos.net.nfs.server (to reject)

●ex: installp -u bos.net.nfs.server (to uninstall)

●installp -C bos.net.nfs.server (to clear the failed and improper filesets)

Page 4: AIX Foundation-Basic Commands+

4

●lppchk -v (v-verify filesets)

●g _ dependent filesets

●p _ preview

●X _ expand /tmp for install

●Y_ accept the license

●-ag (or) –ap (or) -aX (or) -aY

●ex: installp -L -d /dev/cd0 (to list the fileset in cdrom)

●lslpp -l (to list all installed filesets)

●ex: lslpp -l | grep -i bos.net.nfs.server (to list the particular fileset)

●ex: lslpp -h bos.net.nfs.server (to check updated level (or) history of the fileset)

●lslpp -f bos.net.nfs.server

▪o/p > /sbin/automount (to list files in the fileset)

●lslpp -w /sbin/automount

▪o/p > bos.net.nfs.server (to find out the fileset in which the file is available)

●smitty (system management interface (or) interactive tool

●Smitty is a command line graphical tool. i e. Menu based.

●stty erase (backspace) enter-to set backspace key to delete commands for this session.

●istat <filename> (or) <directory name> (to list file (or) directory full details)

USER ADMINISTRATION:

●File Permission: r-read[4], w-write[2], x-execute[1]

●Maximum Permission for File → 666 (777), Maximum Permission for Directory → 777

●UMASK-Reversal of file permission (000-full permission)

●chmod (to change permission)

●ex: chmod 644 <filename>

●ex: chmod 755 <directory>

Page 5: AIX Foundation-Basic Commands+

5

●chmod -R 755 <directory> (to change permission for all files and sub directories)

●chgrp <group name> <file>/<directory> (to change the group of the file or directory)

●chown <username>:<groupname> <directory>/<file> (to change the ownership of a file or

directory) (or)

● chown <username>.<groupname> <directory>/<file> (to change the ownership of a file or

directory)

●Extended file permissions:

●suid (set user id)***

●suid-set for commands, to allow all users to run command with root (owner) privileges at

the time of execution.

●ex: chmod 4555 <cmd> ex: passwd

●ls -al <cmd> → [-r-sr-xr-x]

●sgid (set group id)

●set for command (or) directory

●sgid-if set for directory, group privileges will be granted for the time of running cmd

●ex: chmod 2555 <cmd> ex: crontab

●sgid-if set for directory, any file created by any user will have group membership of that

directory

●ex: ls -ld <directory> → *dr-xr-sr-x]

●STVX-sticky bit:***

●set for a directory

●ex: chmod 1777 /dir

●ls -ld <directory> → drwxrwxrwt

●Restrict the users to remove/rename of other users files/sub directory under the directory,

but we can work on other user files.

●ex: By default /tmp is set as sticky bit

●mkuser <username> (to add a user)

●mkuser ,attributes- <username> (to add attributes to user while creating username)

Page 6: AIX Foundation-Basic Commands+

6

●smitty mkuser (to add user through graphical cmd line)

●chuser ,attributes- <username> (to modify attributes)

●lsuser ALL (to list all users details)

●lsuser <username> (to list the specific user details)

●lsuser -f <username> (to list the user details in stanza format)

●rmuser <username> (to remove user account & not the home directory)

●userdel -r <username> (to remove user details with home directory)

●rm -r /home/<username> (to remove the home directory of the specific user)

●Important Files_User Administration:

●/etc/passwd (contains basic user attributes)

●/etc/security/user (contains extended user attributes)

●/etc/security/passwd (contains password information for all users)

●/etc/security/limits (contains user limits for users)

●/etc/security/lastlog (keeps the last successful & last unsuccessful login default)

●/etc/environment (contains global environment variables applicable to all process & users)

●/etc/profile (contains global variables applicable for all users)

●$HOME/.profile (contains customized variables/commands only applicable for a user)

●/etc/security/failedlogin (contains failed login information of all users){use who -a,strings}

●/etc/utmp (contains currently logged in details)

●/var/adm/wtmp (contains connect time details of all users since server build)

●/etc/security/login.cfg (login settings applicable for entire OS)

●/usr/lib/security/mkuser.default (used during user creation for setting basic user

attributes)

●/etc/group (contains group details and its group users)

●/etc/motd (message of the day)

Page 7: AIX Foundation-Basic Commands+

7

DEVICES MANAGEMENT:

●Device Database - /etc/objrepos/*

●▪PdDv - Predefined Devices (supported devices), CuDv – Customized Devices

(supporting/currently configured devices)

●▪Device status- 1.Available, 2.Defined, 3.Removed

●lsdev -C (to list all devices)

●lsdev -C –c disk (list the hard disks)

●mkdev -l hdisk# (to make available of a device) [defined to available]

●rmdev -l hdisk# [available to defined]

●rmdev -dl hdisk# (to remove a device permanently from ODM database)

●cfgmgr (to add (or) detect new hardware)

●cfgmgr -i /usr/sys/inst.images/drivers/

●lsdev -C -r class (to list customized class)

●lsdev -P -c disk (to list predefined devices)

●lsdev -C -l cd0 -F parent (to find the parent of particular child device)

●lsdev -p scsi0 (to list child devices in a parent)

●lscfg -vpl hdisk# (to list virtual product information)

●lsattr -EHl hdisk# (to list device attributes)

●prtconf (to print the configuration of the server)

●prtconf -m (memory of the server)

●prtconf -c (cpu type of the server [32/64 bit])

●prtconf -k (current kernel of the server [32/64 bit])

Page 8: AIX Foundation-Basic Commands+

8

LOGICAL VOLUME MANAGEMENT:

*PV-Physical Volume, *VG-Volume Group, *LV-Logical Volume, *PP-Physical Partition,

*LP-Logical Partition, *FS-File System, *VGDA- Volume Group Descriptor Area, *VGSA-

Volume Group Status Area.

●QUORUM-Its is a feature of a VG in a line condition, where minimum 51% of VGDA

information should be maintained.

●VG Types: Normal VG, Big VG, Scalable VG.

●Normal VG: No of PV’s=32,No of LV’s=256,PP Size=1MB-1GB, No of PP’s/PV=1016

●Big VG: No of PV’s=128,No of LV’s=512,PP Size=1MB-1GB, No of PP’s/PV=1016

●Scalable VG: No of PV’s=1024,No of LV’s=4096,PP Size=1MB-128GB, No of PP’s/PV=1016

●chvg -t 2 <vgname> *“t” factor]

●lspv ( to list all PV’s & to check free PV’s+

●chdev -l hdisk1 -a pv=yes

●lspv <pvname> (to list PV related information)

●ex: lspv hdisk0

●lspv -l <pvname> (to list all LV in the PV)

●migratepv -l <lv> <source> <destination> (to move one LV from one PV to another PV)

●ex: migratepv -l lv1 hdisk0 hdisk1

●migratepv hdisk# hdisk# (to move all LV from one PV to another PV)

●ex: migratepv hdisk0 hdisk1

●lsvg (to list all VG)

●lsvg -o (to list online VG’s only)

●varyonvg <vgname> (to activate a VG)

●varyoffvg <vgname> (to deactivate a VG)

●lsvg <vgname> (to list VG related information)

●lsvg -p <vgname> (to list PV’s in the VG)*

●lsvg -l <vgname> (to list LV’s in the VG) *

Page 9: AIX Foundation-Basic Commands+

9

●Create VG’s:

●Normal VG: f-force, y-yes, name , s-size(in MB)

●mkvg -f -y <vgname> -s <pp size> hdisk#

●ex: mkvg -y newvg -s 64 hdisk2

●Big VG:

●mkvg -B -y <vgname> -s <pp size> hdisk#

●Scalable VG:

●mkvg -S -y <vgname> -s <pp size> hdisk#

●Convert VG’s

●chvg -B <vgname> (to convert Normal VG into Big VG)

●varyoffvg <vgname>

●chvg -G <vgname> (to convert Normal VG into Scalable VG)

●varyonvg <vgname>

●chvg -Q y <vgname> (to enable QUORUM)

●chvg -Q n <vgname> (to disable QUORUM)

●Mirror RootVG:

●lspv (to get the free hdisk & space)

●ipl_varyon -i (to check boot image)

●extendvg rootvg hdisk# (to add additional PV into rootvg)

●mirrorvg -S rootvg hdisk1 (to copy rootvg from hdisk0 to hdisk1 in background)

●bosboot -ad /dev/hdisk1 (to update boot image manually)

●bootlist -m normal hdisk0 hdisk1 (to change boot order)

●lsvg -l rootvg (to confirm rootvg mirror)

●sync -v rootvg (sync mirrored VG manually)

●syncvg -fl <lvname> (sync particular LV manually)

●chvg -an <datavg> (to disable auto varyon feature of datavg)

Page 10: AIX Foundation-Basic Commands+

10

●Unmirror RootVG:

●unmirrorvg rootvg hdisk1 (to remove data from hdisk1)

●chpv -c hdisk1 (to remove boot records from hdisk1)

●reduce rootvg hdisk1 (to remove hdisk1 from rootvg)

●rmdev -dl hdisk1 (to remove hdisk1 from ODM)

●Rename DataVG (or) Export&Import storage disk:

●unmount the filesystem in datavg

●varyoffvg datavg (to temporarily deactivate the VG)

●exportvg datavg (to remove VG related info from ODM & /etc/filesystem entries related

datavg)

●importvg -y datavg/newvg hdisk1 (it will update ODM from VGDA info of hdisk1 & update

entries in /etc/filesystem)

●Logical Volume:

●Create LV: y-yes, name, t-filesystem type, c-no of copies

●mklv -y <lvname> -t jfs2 <vgname> 5 {hdisk#}

●mklv -y <lvname> -t jfs2 -c 2 <vgname> 5 hdisk1 hdisk2 (to create LV with copy(mirror)

while creating LV)

●mklvcopy <lvname> 2 hdisk2 (to make a copy after creating a LV)

●rmlvcopy <lvname> 1 hdisk2 (to remove a copy)

●extendlv <lvname> 2 (not possible to reduce PP in a LV)

●rmlv <lvname> ( to remove a LV completely)

●lslv <lvname> (to list LV related information’s)

●lslv -m <lvname> (to check LV is mirrored or not)

●lslv -l <lvname> ( to check the PV in which LV is created)

Page 11: AIX Foundation-Basic Commands+

11

FILESYSTEM MANAGEMENT:

●Filesystem types: jfs/jfs2

●Super Block: When creating a filesystem in LV, one of the block is reserved for super block.

●Super block contains Total no of inodes & Total no of data blocks.

●Create Filesystem: v-vfs(virtual filesystem), d-directory, m-mountpoint

●crfs -v jfs2 -d /dev/<lvname> -m /<filesystem>[mountpoint name] (In already created LV)

●mount /<filesystem> (to mount the filesystem)

●unmount /<filesystem> (to unmount the filesystem)

●crfs -v jfs2 -g <vgname> -a size=100M -m /<filesystem> (to create LV and filesystem

simultaneously)(it’s not possible to specify PV for creating LV)

●lsfs /<filesystem> (to list filesystem information)

●lsfs -q /<filesystem> (to list filesystem information)

●mount (to check mounted filesystem)

●df -m /<filesystem> (to check free space in specific filesystem in MB)

●du -sm /<filesystem> (to check disk usage of specific filesystem)

●Increase FS size:

●chfs -a size=+100M /<filesystem> (to increase filesystem size)

●Reduce FS size:

●chfs -a size=-100M /<filesystem> (to reduce filesystem size)

●Set FS for automount:

●chfs -A yes /<filesystem> (to set filesystem for automount)

●To rename FS names:

●ex: chfs -m /newfs /orafs[old] (to rename filesystem name)

●unmount /orafs

●mount /newfs

Page 12: AIX Foundation-Basic Commands+

12

●To remove FS:

●unmount /newfs

●rmfs /newfs

●Check → tail /etc/filesystem

BACKUP & RECOVERY:

●Rootvg backup: i-create /image.data, e-exclude any FS in rootvg, f-device file.

●mksysb-make system bootable

●mksysb -i -e -f /dev/rmt0

●tcopy /dev/rmt0 (tape copy) (or)

●smitty lsmksysb

●smitty mksysb (backup rootvg)

●smitty restmksysb (restore rootvg)

●Datavg backup:

●savevg -i -e -f /dev/rmt0 <vgname>

●smitty savevg (to backup datavg)

●smitty restvg (to restore datavg)

●Files Backup (TAR): c-create, v-view, f-filename

●ex: tar -c -v -f f5.tar f1 f2 f3 (relative path)

●ex: tar -cvf f5.tar /home/f1 /tmp/f3 /usr/f3 (absolute path) (files will be restored in the

same path)

●ex: tar -tvf f5.tar (to verify files in tar)

●ex: tar -xvf f5.tar /etc/group (to extract (or) restore all files from a tar file)

●ex: gzip f5.tar {t5.tar.gz (2mb-less compressed)}

●ex: gunzip f5.tar.gz {f5.tar(10mb-more compressed)}

●ex: tar -xvf f5.tar f1 ( to restore (or) extract a particular file)*

Page 13: AIX Foundation-Basic Commands+

13

●ex: tar -rvf f5.tar f4 (to add (or) append additional files in a tar file)*

●Files Backup (PAX for Unlimited size of compression)

●ex: pax -wvf f5.pax f1 f2 f3 (to create)

●ex: pax -vf f5.pax (to verify)

●ex: pax -rvf f5.pax f1 ( to restore a particular file)

●ex: pax -avf f5.pax f6 (to add (or) append a additional file)

●File Systems Backup: u-update

●All backup information’s of filesystems will be updated in /etc/dumpdates

●ex: backup -0uf /dev/rmt0 /home (Sunday)

●ex: backup -2uf /dev/rmt0 /home (Monday)

●ex: backup -3uf /dev/rmt0 /home (Tuesday)

●ex: backup -4uf /dev/rmt0 /home (Wednesday)

●ex: backup -5uf /dev/rmt0 /home (Thursday)

●ex: backup -1uf /dev/rmt0 /home (Friday)

●restore -Tvqf /dev/rmt0 (to verify)

●restore -rvqf /dev/rmt0 (to restore entire filesystem)

●restore -xvqf /dev/rmt0 <filename> (to restore particular file)*

●tctl -f /dev/rmt0 rewind (to rewind the tape)

●tctl -f /dev/rmt0 offline (to eject the tape)

●tctl -f /dev/rmt0 fef 3 (to move the pointer to the 4th location)

●restore -xvqf /dev/rmt0 <filename>* (to restore a particular file)

●restore -s 4 -xvqf /dev/rmt0 <filename> (skip to the 4th location)

●Clone RootVG: (alternate disk installation) ***

●During TL update (or) when major OS related changes.

●lspv

▪o/p hdisk0 rootvg

Page 14: AIX Foundation-Basic Commands+

14

▪o/p hdisk1 rootvg

●bootinfo -b

●unmirror rootvg and remove hdisk1

●lspv

▪o/p hdisk0 rootvg

▪o/p hdisk1 none

●alt_disk_install -B -C hdisk1 (B-not to update boot order once cloning completed, C-clone)

●alt_disk_copy -d hdisk1

●smitty alt_clone

●lspv

▪o/p hdisk0 rootvg

▪o/p hdisk1 altinst_rootvg

●bootlist -m normal hdisk1 (change the boot order before reboot)

●shutdown -Fr (reboot)

●lspv

▪o/p hdisk0 old_rootvg

▪o/p hdisk1 rootvg

●bootlist -m normal hdisk0 (change the bootdown to (hdisk0) actual/original rootvg &

reboot

●shutdown -Fr

●lspv

▪o/p hdisk0 rootvg

▪o/p hdisk1 altinst_rootvg

●alt_disk_install -X altinst_rootvg (to remove the clone disk)

●lspv ▪o/p hdisk0 rootvg

▪o/p hdisk1 none (then reattach the hdisk1 into rootvg and then remirror)

Page 15: AIX Foundation-Basic Commands+

15

MULTI BOS:

●multibos -sX (to create standby bos and if required filename), X-extend the space

●multibos -S (to enter into standby bos)

●multibos -m (to mount multibos filesystem)

●multibos -u (to unmount multibos filesystem)

●bootlist -m normal hdisk0 blv=hd5 hdisk0 blv=bos,hd5 (to change boot order)

●multibos -R (to remove multibos)

PAGING SPACE:

●Paging Space is support time for Main Memory. a-activate automatically swap space, s-size

●mkps -a -s 10 swapvg hdisk3 (create paging space with 10-no of LP’s)

●swapon /dev/paging00 (to activate paging space)

●lsps -a (to get detailed output of a paging space)

●lsps -s (to get summary of paging space usage)

●swap -l (to list paging space usage in pages)

●ex: chps -s 2 paging00 (to increase the size of paging space dynamically [online] 10+2=12)*

●ex: chps -d 5 paging00 (to reduce the size of paging space dynamically [online] 12-5=7)*

●swapoff /dev/paging00 (deactivate the paging space to remove)

●rmps paging00 (remove paging space)

SYSTEM RESOURCE CONTROLLER: (SRC)[Services]*

●SRC-Daemon controlling Mechanism

●ps -ef (to check all (b/g & f/g) process running in the server)

●kill -9 <pid> (to kill the process immediately)

●kill -15 <pid> (to save and kill the process properly)

Page 16: AIX Foundation-Basic Commands+

16

●ps -ef |grep -i defunc (to list the defunction process only)

●inetd(Internetworking Daemon (or) Super Daemon)

●vi /etc/inetd.conf (or)

●chsubserver -a -v <service name> -p <protocol> (a-add/activate (or) uncomment in

inetd.conf file)

●chsubserver -d -v <service name> -p <protocol> (d-delete/deactivate (or) comment in

inetd.conf file)

●refresh -s inetd (to update changes)

●To Start SRC: g-group,

●startsrc -g nfs (to start all daemons under the service nfs)

●startsrc -s nfsd, biod, named (to start only particular daemon)

●startsrc -t ftp, tftp, bootp

●To Stop SRC:

●stopsrc -g nfs (to stop all daemons under the service nfs)

●stopsrc -s biod, rpc.mounted (to stop only particular daemon)

●stopsrc -t ftp

●To List SRC:

●lssrc -a | more

●lssrc -g nfs, tcpip

●lssrc -s nfsd

●lssrc -t ftp

●lssrc -s inetd

●lssrc -ls inedt (to list running supported daemons under this daemon)

Page 17: AIX Foundation-Basic Commands+

17

MANAGING LAN:

●ent-Physical (MAC) Address, en-Logical Interface(Assign IP Address)

●IPV4 Classes Subnet Mask

●CLASS A → 1-127 255.0.0.0

●CLASS B → 128-191 255.255.0.0

●CLASS C → 192-223 255.255.255.0

●CLASS D → 224-239 (Reserved for multicast)

●CLASS E → 240-255 (Reserved for experimental, used for research)

●Private Address Space

●CLASS A → 10.0.0.0-10.255.255.255

●CLASS B → 172.16.0.0-172.31.255.255

●CLASS C → 192.168.0.0-192.168.255.255

●127.0.0.1 (Loopback Address)

●smitty mktcpip (to assign IP permanently) (or)

●mktcpip -i <int> -h <hostname> -a <IP address> -m <subnet mask> -s

●Assign Alias IP:

●ifconfig <int> <ip> <network> alias (temp alias)

●ifconfig en# 192.168.10.10 alias (assign alias IP)

●ifconfig en# <ip> delete (delete IP address)

●ifconfig en# down (down the IP)

●ifconfig en# up (up the IP)

●chdev -l en# -a alias4=<ip address>,<subnet mask> (permanent alias)

●lsattr -EHl en# ( to find the IP is permanent (or) temporary)

●ifconfig -a (to display all interfaces IP details)

●lsdev -c adapter

●lsdev -c if

Page 18: AIX Foundation-Basic Commands+

18

●To Assign Gateway:

●smitty mkroute (permanent)

●route add -net 10.0.0.1(network) 192.168.0.1(gateway) (or)

●route add -host 10.0.0.1(host) 192.168.0.1(gateway) (to assign gateway IP temporarily)

●route add 0 192.169.0.1 (0-allow all networks)

●netstat -rn (to check routing table)*

●lsattr -EHl inet0 (to check the route in permanent)*

NFS (Network File System):

●mount -v cdrfs -o ro/rw /dev/cd# /<mount point>

●ex: mount -v cdrfs -o ro dev/cd0 /mnt

●Steps for NFS (Server):

●Filesets to install:

●lslpp -l bos.net.nfs.server

●installp -a -d /dev/cd0 bos.net.nfs.server

●Daemons for NFS:

●lssrc -g nfs

●lssrc -s portmap (port no 111)

●startsrc -g nfs (or)

●mknfs -N

●crfs -v jfs2 -g rootvg -a size=10G -m /nfs share

●Define Export:

●vi /etc/exports (edit to make permanent export) (or)

●smitty mknfsexp (to make permanent/temporary exports)

●Export Share:

●exportfs -a (export the directories configured) (or)

Page 19: AIX Foundation-Basic Commands+

19

●exportfs -i </dir> (export a directory)

●exportfs -u </dir> (to unmount the export directory)

●Remove Share:

●rmnfsexp (or)

●smitty rmnfsexp

●Check Exports:

●showmount -e (or)

●exportfs (&)

●mount -v nfs <server>:/<dir> /<local mount point>

●df -m /<local mount point>

●chmod 777 /nfsshare

●lmktemp file 512M (^)

●NFS Client: By default the client (bos.net.nfs.client) will be installed in AIX

●lssrc -s biod (daemons should be checked)

●lssrc -s portmap (daemons should be checked)

●showmount -e <nfs server name> (or) *

●showmount -e <nfs server IP>*

●smitty mknfsmnt (to mount permanently /etc/filesystem)

●mount -v nfs <nfs server>:/<share> /<local dir>

●chfs -A yes /nfsmnt (set false (or) true)

BOOT PROCESS:

●POST-Power On Self Test, IPL-Initial Program Loader

●ipl_varyon -i (to see the bootable disk)

●AIX Boot Phases: rc-run control, BLV-Boot Logical Volume

●1.ROS phase (Read Only Storage)-BIOS Initialization Phase, Kernel Initialization Phase

Page 20: AIX Foundation-Basic Commands+

20

●2.rc.boot phase-1.Access rootvg(Base Devices configuration),2.Activates rootvg(Primary

paging space activation), 3.Other than Base devices configuration.

●3.init phase-1.Initilization phase (/etc/inittab phase)[will make system ready for use. All

application, services started in this phase]

●1.ROS phase

●▪Locator IPL (software ROS)

●▪Locator BLV & loads control over BLV

●▪RAM FS created

●▪Kernel gets loaded into RAM FS.

●2.rc.boot phase1 (access rootvg)*

●▪restbase (loads ODM into RAM FS)

●▪cfgmgr -f (to configure rules to access rootvg devices)

●▪bootinfo -b (to check and confirm last boot device)

●rc.boot phase2 (activates the rootvg + primary paging system)

●▪ipl_varyon (to activate rootvg)

●▪fsck -f /dev/hd4 & mount / on RAM FS

●▪fsck -f /dev/hd9var (mount /var), fsck -f /dev/hd2 (mount /usr)

●▪copycore (to move any dump info in case of OS crash into /var/adm/ras/vmcore.x)

●▪swapon /dev/hd6

●▪/,/usr,/var unmounted & mounted on their own mount points (disk based)

●▪RAM FS cleared & used for further boot process

●▪fsck -y /dev/hd4, fsck -y /dev/hd2, fsck -y /dev/hd9var

●rc.boot phase3 (other than base devices configuration)

●▪mount /tmp

●▪syncvg rootvg (to synchronize any state of PP’s if rootvg mirrored in background)

●▪cfgmgr -p2 (to configure all devices except base devices)

Page 21: AIX Foundation-Basic Commands+

21

●▪cfgcon (to configure console device), 0C31-not configured, 0C32-is a lft, 0C33-is a tty,

0C343-is redirected to a file

●▪savebase (to synchronize ODM information in /[hd4] FS with BLV [hd5]

●▪syncd, err daemon started

●▪OP code display goes off

●▪mouse initialization completed

●▪starts the init phase

●3.init phase: (initialization phase)

●▪To make/bring the system really to use

●▪Application/session get started

●▪Refers /etc/inittab file

●AIX RUN Levels

●init 0, init 1 (reserved for future)

●init 2 (Default run level with NFS support)

●3,4,5,6,7,8,9 (customized run level)

●s,S,m,M (Single user mode/Maintenance mode)

●telinit

●Actions:

●wait-starts the process & wait for completion & scans next line

●once-starts the process & scans next time

●Respawn-1.starts the process if doesn’t exist, 2.restarts if it dies, 3.does nothing if

running.*

●/etc/rc (file)

●▪varyon all VG’s which are marked as auto_varyon=yes

●▪mounts all FS which are marked as mount=true, in /etc/filesystems

●▪activates all PS which are in /etc/swapspaces

●▪configure dump devices

Page 22: AIX Foundation-Basic Commands+

22

●/etc/rc.tcpip (file)

●▪configures all tcpip related daemons like inetd, rwhod, named, routed, sendmail, lpd etc...

●/etc/rc.net (file)

●▪configures IP address on interfaces

●▪configures router/gateway on OS

●COMMANDS FOR BOOT PROCESS:

●mkitab “lineid:runlevel:action:cmd” (to add entry)

●ex: mkitab “test:234:once:/usr/bin/date => /dev/pts2”

●ex: chitab “test:2:respawn:/usr/bin/date >> f1” (to change entries)

●rmitab <lineid>

●ex: rmitab test

●lsitab -a ( to list all entries)

●lsitab init (to see default run level set)

●lsitab test

●who -r ( to see running level [current])

KERNEL CONVERSION: 32 bit ↔ 64bit

●Kernel Directory → /usr/lib/boot/unix_64 (64 bit kernel), /usr/lib/boot/unix_mp (32 bit

kernel [multiprocessor])

●Convert 32bit → 64bit:

●To Check Kernel Version and Hardware type

●bootinfo -y

●prtconf -c

●getconf HARDWARE_BITMODE

●To check running Kernel

●bootinfo -k

Page 23: AIX Foundation-Basic Commands+

23

●prtconf -k

●getconf KERNEL_BITMODE

●ls -al /unix → /usr/lib/boot/unix_up

●To convert 32bit to 64bit:

●ln -sf /usr/lib/boot/unix_64 /unix

●ln -sf /usr/lib/boot/unix_64 /unix/lib/boot/unix

●bosboot -ad /dev/hdisk#

●sync; sync; reboot -q

LINKS:

●HARD LINK & SOFT LINK

●Hard Link:

●▪It is an alias to a file

●▪The inode value will be same for source & link file

●▪It can reside on source partition (LV)

●▪Even source file deleted, still link file will point to the data

●ex: ln f1 f2

●ex: ln f1 f3

●ex: ln -al f1 f2 f3

●Soft Link: s-soft link

●▪It is a shortcut to a source file

●▪It will have a different inode no, data of this file is pointing to the address of the source

●▪It can span across different partitions (LV)

●▪If the source file is deleted, then the link is broken.

●ex: ln -s /home/xyz/abc /hello

Page 24: AIX Foundation-Basic Commands+

24

ALOG:

●alog-To read some of the log files under /var/adm/ras (ras-reliable available serviceable)

●alog -L (to list alog supported database)

●alog -ot <database type> (or)

●alog -of <full path name of log file>

●ex: alog -ot boot, bosinst , nim* (or)

●ex: alog -of /var/adm/ras/bootlog

●Database & Related files

●boot → /var/adm/ras/bootlog

●bosinst → /var/adm/ras/bosinstlog

●console → /var/adm/ras/console

●nim → /var/adm/ras/nimlog

ERRPT:

●errpt-Used to read the information from /var/adm/ras/errlog

●Daemon → /usr/lib/errdaemon

●logfile → /var/adm/ras/errlog

●errpt (to list the details of errpt)

●errpt -aj <error id> |more (to view specific error id details)

●errpt -s <time stamp> -e <end time stamp)

●To clear error log entries: (errclear)

●errclear -d S 0 (to clear particular error log) (or)

●errclear -d H 0 (to clear particular error log) (or)

●errclear -d O 0 (to clear particular error log)

●errclear -j <error id> 0 (to clear specific error id)

●errclear 0 (to clear all the error log entries )

Page 25: AIX Foundation-Basic Commands+

25

●> /var/adm/ras/errlog (to nullify the errlog file) *Don’t nullify the errlog file]

●To rectify if the file is nullified:

●/usr/lib/errstop (to stop daemon)

●rm /var/ad,/ras/errlog

●/usr/lib/errdemon (to start daemon)

DUMP DEVICES:

●▪It is a LV type (sysdump), system usable created on rootvg disks.

●▪Dump Information: Used to hold the dump information in case of OS, Application, H/W

crash.

●▪Used for troubleshooting the crash reason (or) RCA (Root Cause Analysis)

●Types: Primary dump device & Secondary dump device: p-primary, s-secondary

●Primary dump device → /dev/hd6 (by default)

●Secondary dump devices → /dev/sysdumpnull

●{ /dev/lg_dumplv00 (or) /dev/dumplv00 } In Real

●{ /dev/lg_dumplv01 (or) /dev/dumplv01 } In Real

●To Define a Dump Device:

●mklv -t sysdump -y dumplv00 rootvg <size in PP’s *MB or GB+> hdisk0

●mklv -t sysdump -y dumplv01 rootvg

●sysdump -e (to estimate the dump LV size required)

●Primary: sysdump -P -p /dev/dumplv00

●Secondary: sysdump -P -s /dev/dumplv01

●sysdumpdev -l (to list dump LV’s configured *defined+)

●sysdumpdev -L (or) sysdumpdev -z (to view any dump occurred (or) not)

●savecore -f -d /var/adm/ras/<dump filename> (to move dump from LV into a

file[manually])

Page 26: AIX Foundation-Basic Commands+

26

●savecore -d /tmp/<dump filename>

●/var/adm/ras/vmcore.0 & /var/adm/ras/vmcore.1 (Default Dump moving directory during

crash followed by boot)

SCHEDULING TASKS:

●command-crontab

●crontab files → /var/adm/cron/cron.allow, cron.deny

●User job files → /var/spool/cron/crontabs/root,sys,oracle,test

●log file → /var/adm/cron/log

●Daemon → /var/sbin/cron & /var/bin/cron

●crontab -e (schedule root jobs)

●crontab -l (to list scheduled jobs)

ODM (OBJECT DATA MANAGER):

●ODM - It is an object oriented binary database (Configuration Information’s)

●Default ODM directory → /etc/objrepos

●Configuration information’s: Devices configuration, Fileset configuration, Network

configuration, LVM configuration.

●Commands for ODM:

●odmget CuDv | more (or) lsdev -C

●odmget CuAt | more (or) lscfg -EH

●odmget lpp | more (or) lslpp -l

●odmget CuVPD | more (or) lscfg -VP

●odmget product/inventory (or) lslpp -f

●odmget history | more (or) lslpp -h

●odmdelete; odmadd; odmchange; odmmodify

Page 27: AIX Foundation-Basic Commands+

27

●odmget -q name=hdisk0 CuDv | grep -i parent (or) lsdev -l hdisk0 -f parent

●odmget -q name=hdisk0 CuAt

●odmdelete -q name=hdisk# -o CuDv

●odmdelete -q name=hdisk# -o CuAt

●ex: mkdir /etc/objrepos/backup

●ex: cp -p /etc/objrepos/Cu* /etc/objrepos/backup/

VI EDITOR:

●3 modes of operation:

●▪Command Mode (or) Esc mode (to move cursor position)

●▪Insert\Edit\Append mode (to enter into edit operation)

●▪Last line mode (to quit, save, and exit options)

●ESC MODE/COMMAMD MODE [Navigation Keys]: ←↓↑→

●Esc + h [←] (moves 1 character left)

●Esc + l [→] (moves 1 character right)

●Esc + k [↑] (moves 1 line upwards)

●Esc + j [↓] (moves 1 line downwards)

●ex: esc + h [10 h] (moves 10 character left)

●ex: esc + l [20 l] (moves 20 character right)

●ex: esc + k [5 k] (moves 5 lines upwards)

●ex: esc + j [10 j] (moves 10 lines downwards)

●Esc + G (moves to the last line of the file)

●Esc + 1G (moves to the first line of the file)

●ex: esc + 20G (moves to the 20th line in a file)

●Esc + P (paste the content above the cursor position)

●Esc + p (paste the content below the cursor position)

Page 28: AIX Foundation-Basic Commands+

28

●Esc + u (undo the last/recent change)

●Copy:

●Esc + yy (copy a line)

●Esc + yw (copy a word)

●Esc + yl (copy a character)

●Cut:

●Esc + cc (cut a line)

●Esc + cw (cut a word)

●Esc + cl (cut a character)

●Delete:

●Esc + dd (delete a line)

●Esc + dw (delete a word)

●Esc + dl (delete a character)

●Esc + x (delete a character)

●Esc + r (replace a character)

●INSERT/EDIT/APPEND MODE:

●Esc + i (enter into insert mode)

●Esc + a (enter into append mode)

●Esc + I {i} (moves to the beginning of the line)

●Esc + A (moves to the end of the line)

●Esc + o (open a empty line below the cursor position)

●Esc + O (open a empty line above the cursor position)

●LAST LINE MODE (SAVE,QUIT,EXIT):

●Esc + w! (save the current file and remains editing)

●Esc + wq! (save and quit current file) (or) Esc + x

●Esc + w! <filename> (save to another file and remains editing) (or) Esc + x

Page 29: AIX Foundation-Basic Commands+

29

●Esc + wq! <filename> (save to another file and quit)

●Esc + q! (quit without any changes)

●Esc + set nu (add a line numbers in display)

●Esc + set nonu (removes the line numbers)

PROBLEM DETERMINATION AND ANALYSIS:

●Boot Time problem: [rootvg]

●Need bos cd’s or NIM resource to rectify

●Enter into maintenance mode by pressing F5 or 5 (without entering into SMS menu)

●1.Define console (F1 & Enter)

●2.Define Installation Language as English (1 & Enter)

●3.Installation and Maintenance mode

●3a.Start with default settings and install

●3b.Change/Show installation settings and install

●3c.Maintenance Mode for System Recovery

●¤1.Access rootvg with mounted filesystems (OS) and start a shell

●¤2.Access rootvg before mounting filesystems and start a shell

●Important ERROR Codes:

●Error Code → 201: (Corrupted boot image [BLV]]

●Action: Select Option ¤1.Access rootvg with mounted filesystems and start a shell

●df / & df /tmp (check for free space in root and tmp, if no enough space)

●chfs -a size=+{n}M <FS>

●lslv -m hd5 (to define a BLV disk)

●bosboot -ad /dev/hdisk# (to rebuild BLV)

●bootlist -om normal (to check boot order)

●ipl_varyon -i

Page 30: AIX Foundation-Basic Commands+

30

●sync; sync; reboot -q

●Error Code → 0551, 0552, 0557, 0518: (Corrupted jfs/jfs2 FS and corrupted jfs/jfs2 log)

●Action: Select Option ¤2.Access rootvg without filesystems and start a shell

●fsck -y /dev/hd1, /dev/hd2, /dev/hd3, /dev/hd4, /dev/hd9var (run fsck to rectify FS

related mount issues)

●/usr/sbin/logform /dev/hd8 (to clear the jfs/jfs2 log)

●lslv -m hd5

●bosboot -ad /dev/hdisk#

●ipl_varyon -i

●bootlist -om normal

●sync; sync; shutdown -Fr

●Error Code → 0553: (Corrupted/missing /etc/inittab file)

●Action: Select Option ¤1.Access rootvg with mounted filesystems and start a shell

●df /, /tmp, /var (check for free space in root, tmp, var if no enough space)

●chfs -a size=+{n}M <FS>

●Check for /etc/environment & /etc/inittab files for any wrong/missing entries and rectify

them if any.

●bootlist -om normal

●sync; sync; reboot -q

●Error Code → 0552, 0554, 0556: (SuperBlock [damaged FS] corrupted (or) ODM corrupted

●Action: Select Option ¤2.Access rootvg without filesystems and start a shell

●fsck -y /dev/hd1, /dev/hd2, /dev/hd3, /dev/hd4, /dev/hd9var (If error like block number

0-8 damaged, superblock is corrupted)

●To rectify primary superblock issue:

●dd if=/dev/hd# of=/dev/hd# bs=4k count=1 skip=31 seek=1 ***

●/usr/sbin/logform /dev/hd8

●bootlist -om normal

Page 31: AIX Foundation-Basic Commands+

31

●sync; sync; reboot

●To rectify ODM corruption:

●mount /dev/hd4 /mnt & mount /dev/hd2 /usr

●mkdir /mnt/etc/objrepos/backup

●mv /mnt/etc/objrepos/Cu* /mnt/etc/objrepos/backup

●cp -p /etc/objrepos/Cu* /mnt/etc/objrepos/

●savebase -d /dev/hdisk#

●umount /usr & umount /mnt

●bootlist -om normal

●sync; sync; reboot -q (if error occurs even after reboot, restore bos)

●Failed PV replacement on Mirrored rootvg: ***

●Identify the failed PV:

●lsvg -l rootvg (look for any stale PP’s information)

●errpt | more -i hdisk

●Break the rootvg Mirror:

●unmirrorvg rootvg hdisk#

●Unconfigure any dump LV:

●lspv -l hdisk# (look for any dump LV)

●sysdumpdev -l

●sysdumpdev -P -p /dev/sysdumpnull (primary)

●sysdumpdev -P -s /dev/sysdumpnull (secondary)

●rmlv <dumplv#>

●Reduce the PV from VG:

●reducevg rootvg hdisk#

●Close the boot record info:

●chpv -c hdisk#

Page 32: AIX Foundation-Basic Commands+

32

●To remove a PV: [Hot pluggable hdisk bay]

●diag→task seleciton→hot plug task→hot plug (identify the PV location to be removed) PC1

RAID MANAGER

●rmdev -dl hdisk#

●Remove the failed PV from identified slot and insert new PV:

●cfgmgr

●Replace a PV:

●lspv

●extendvg rootvg hdisk#

●mirrorvg -S rootvg hdisk#

●Configure the dumplv:

●mklv -y <dumplv> rootvg <no of PV’s> hdisk#

●sysdumpdev -P -p /dev/<dumplv> (primary)

●sysdumpdev -P -s /dev/<dumplv> (secondary)

●Recreate BLV boot:

●bosboot -ad /dev/hdisk#

●lsvg -l rootvg

●errpt | grep -i hdisk#

●To rectify corrupted datavg: (Failed PV)

●exportvg datavg (to remove datavg from ODM & /etc/filesystems

●rmdev -dl hdisk# (to remove PV from ODM)

●smitty restvg (to restore backup from tape)

Page 33: AIX Foundation-Basic Commands+

33

PERFOMANCE MONITORING:

●Types of process: 1.Foreground process, 2.Background process, 3.Zombie process

●ps -ef (to list all f/g & b/g process)

●ps -ef | grep -i defunc (to list zombie process)

●kill -9 <pid>

●vmstat (to check virtual memory statistics)

●ex: vmstat 2 (to check every 2 sec’s)

●ex: vmstat 2 5 (to check only for 5 times)

●iostat (to check i/o data transfer in i/o devices [hard disk, cd drive])

●ex: iostat 2 5

●iostat -d hdisk0 2 5 (to check particular device [data read/write])

●To check LV level i/o transfer:

●lvmstat -v rootvg -e (to enable LV statistics)

●lvmstat -v rootvg (to display LV i/o usage)

●lvmstat -v rootvg -d (to display LV statistics)

●sar command: (system activity report)

●ex: sar 2 5 (to check CPU utilization)

●% usr→Application, %sys→System Process, %wio→ waiting i/o, %idle→idle

●topas command:

●topas (to check overall resource utilization)

●topas -P (to list only process)

●diag command:

●diag (for diagnostics)

●To check memory usage: (svmon-snapshot of virtual memory)***

●svmon -G -O unit=GB/MB (to display memory usage in GB)

●svmon -P <pid> -O unit=GB/MB (to check particular process’s CPU usage)

Page 34: AIX Foundation-Basic Commands+

34

●svmon -U <username> -O unit=GB/MB (to check CPU usage of process per user)

●svmon -P -t 5 -O unit=GB/MB (to list top most 5 process which are using more memory)

●netstat command:

●netstat -in (to check network related collisions)

●netstat -an | grep -i listen (to list the opened port in port numbers)

●netstat -a | grep -i listen (to list the opened port in names)

●netstat -rn (to list routing related information)

●netstat -v ent0 & netstat -d ent0 (to check network and statistics)

SNAP:

●snap -r (to remove old snap files)

●snap -gc (to create new snap files, to collect general information’s and compress)

●snap -e (HACMP related information collections)

FIXES MANAGEMENT:

●APAR: (Authorized Program Analysis Report) IX<no>,IY<no>,IX<no>

●instfix -k <APAR> -d /dev/cd0 (to install)

●instfix -ik <APAR no> (to verify)

●instfix -i | grep -i ML (to check the history of installed ML/TL)

●EFIX: (Emergency Fix)

●emgr -e <efix> -d /dev/cd0 (to install)

●emgr -l <efix> (to verify)

●emgr -r <efix> (to remove)

●ML/TL Installation: (Major OS related update) similar method for Service Pack installation)

●Pre-Check’s to be done:

●1.Take a backup of rootvg. (a)mksysb, (b)alternate disk (clone rootvg), multibos.

●2.Check for free space in filesystems and increase if necessary. (/, /usr, /var, /tmp)

Page 35: AIX Foundation-Basic Commands+

35

●3.Remove applied efix (old)

●4.Commit filesets which are in apply mode

●smitty maintain_software (commit)

●5.Check for broken or corrupted filesets

●lppcheck -v

●6.Take checklist of following commands

●lspv, lsvg, lsvg -o, lslpp -l, ifconfig -a, bootlist -m normal, df -m, oslevel -s,

lsvg -o | lsvg -il

●Install ML/TL:

●Download latest TL from IBM fix centre (or) through our NFS server

●ex: showmount -e nfsserver

●ex: mount -v nfs nfsserver:/exports/fixes /mnt

●Installation:

●smitty update_all

●▪o/p device location: /mnt

●▪o/p fileset to update: all

●▪o/p commit: no

●▪save replaced files: yes

●▪accept license agreement: yes

●Check after installation:

●oslevel -s, lppchk -v, oslevel -rl (should vary and updated)

●shutdown -Fr (reboot if everything is fine)

●Post-Check’s to be done:

●oslevel -s, lppchk -v, bootinfo -b, df -m, ifconfig -a, lsvg, lsvg -o | lsvg -il

Page 36: AIX Foundation-Basic Commands+

36

ETHERCHANNEL CONFIGURATION:

●It is a redundancy for network cards & switch

●Requirements: Minimum 2 network adapters and should not be configured with any IP

address (en0 &en1)

●Delete if any IP address configured in it by following commands

●ifconfig en0 down

●ifconfig en0 delete

●ifconfig en0 detach

●ifconfig -dl ent0

●cfgmgr

●Same steps to be done for en1:

●smitty etherchannel (list, create, change)

●One of the network adapter acts as primary and other adapter acts as backup.

●We will configure IP address for the etherchannel adapter

●etstat -d ent2 |grep -i active (to check the primary adapter)

●▪o/p ent:primary