Thursday, June 21, 2018

AIX command


Commonly used AIX command
AIX LVM command
Lsvg       List all VG on server
Lsvg –o   List active VG on server
Lsvg –l  vgname                                List all logical volume in volume group
example  of mkvg command.
mkvg -y vgname hdisk0 hdisk1
mkvg -y my_vg –s 128 hdisk0 hdisk1
mkvg -s 2 -t 2 vgname hdisk1
# mkvg -B -y vgname -s 128 -f -n -V 101
# mkvg -S -y vgname -s 128 -f -n -V 101
Flag of mkvg
-s                    specify the physical partition size
-y                    indicate the name of the new vg
-f                     forcefully create volume group
-t                    t factor
-V                 major number of volume group
-S                Create scalable volume group
LV create command
#mklv -t jfs2 -y testlv datavg 60
Flag
-t type of LV
-y LV name
File system creation command
crfs -v jfs2 -d testlv -m /datamnt -A yes
-v  File system Type
-d  device on which we creating file system
-m mount point
-A  automount

#Mount /mount-point  File system mount command.

AIX system resource controller command
lssrc –a                 show all system resource controller and their status
lssrc  –s sshd      show sshd status on server    
lssrc –g nfs            show service status on all services in nfs group

lssrc –g group name                        Command to see service status in specific group
lssrc –s service_name                                    Command to see specific service status

startsrc –g groupname                  To start all services in specific group
stopsrc –g groupname                   To stop all services in specific group
refresh –s service name                               To refresh specific service
refresh –g groupname                  to refresh services in specific group

Command for changing bootlist and showing bootlist on AIX

bootlist -m normal -o    It will  display bootlist for AIX server.
example

#bootlist -m normal -o
output :
hdisk0 blv=hd5 pathid=0

bootlist -b     Show last boot device from which AIX LPAR booted.

bootlist -m normal hdisk0 blv=hd5 hdisk1 blv=hd5    This command change bootlist to hdisk0 and hdisk1

AIX file system utilization command

df -gt     This command display all filesystem which are mounted on AIX server.
df -gt /fsname   Display specific filesysetm disk utilization.

-g  show File system utilization in GB unit
-m show File system utilization in MB unit
-k  show File system utilization in 1024-byte blocks unit


Command to take OS backup on AIX

mksysb -ieX /path_to_take_backup     This command will create AIX mksysb backup with excluded content.

mksysb -iX   This will create full backup of AIX OS.

-i mksz command called to create image.data file.
-e check /etc/exclude.rootvg and exclude required file from backup
-X expand /tmp dynamically if needed


Mirroring AIX rootvg to hdisk1
extendvg rootvg hdisk1
mirrorvg rootvg
bosboot -ad hdisk0
bosboot -ad hdisk1
bootlist -m normal hdisk0 hdisk1



Command To list devices on AIX
cfgmgr  Detect new device on AIX
lsdev  List all devices on AIX LPAR
lsdev -Cc disk    Show disk information on AIX
lsdev -Cc adapter |grep -i fcs  show only FCS adapter information
lsdev -Cc adapter |grep -i ent  show only ethernet adapter information
lscfg -vl fcs0 | grep Network  display wwn of fcs0 adapter


Performance Monitoring
For monitoring performance of AIX LPAR admin can use command like topas,nmon,svmon,ipcs ,vmstat and df .

topas    Monitor top process which are consuming system resources ,also can monitor paging space ,memory and CPU utilization

while topas is running if admin press ~ (tild) then topas switch to nmon mode.

nmon   This command also show information like ,CPU ,Memory and paging
 space.

lsps -s  Show paging space utilization.

# svmon -P -O summary=basic,unit=MB    Virtual memory stats in Mb

#vmstat 2 5   Show five output at interval of 2 second.it contains CPU and memory utilization.

ipcs     Report interprocess communication information like shared memory,semaphore and queue details.

-s semaphore 
-m memory
q- message queue

will update new command .............







Saturday, June 16, 2018

How to shrink AIX file system


Scenario:

df -gt /oracle
Filesystem    GB blocks      Used      Free %Used   Mounted on

/dev/oralv       100.00      49         50   50%    /oracle
/dev/oraloglv    100.00      49         50   50% /  /oralog

shrink /oracle file system by 20 GB and add that space to /oralog filesysetm


solution
:

**make sure that both filesystem are in same volume group,if not then we unable to allocate space
which we shrink from /oracle File system.


then use following command to shrink /oracle


#chfs -a size=-20G /oracle

above command will take some time ....


Then check again size of File system it must be resized to 80 GB.


Then next step is add that 20 GB which we taken from /oracle to /oralog.


command to extend size of /oralog

#chfs -a size=+20G /oralog

new size of /oralog will be 120GB .



AIX JFS -online increase possible ,but decrease not supported.
AIX JFS2-online decrease and increase supported.

QUORUM in aix

what is quorom in aix ?


During my AIX learning day i always wondered about what is quorom and how it affect volume group on AIX ? But after doing google i found answer like below.

Here is the answer :

Number of disk must be present in volume group to successfully vary on volume group in AIX.

"51% is mandatory vgda."


for example, XYZ volume group having 6 disk so mandatory disk for 51% VGDA is 4.

if disk in volume group is 10 then mandatory disk for 51% VGDA is 6.

Its simple


51% VGDA=Number of disk in Volume group/2 +1


so what happen if that mandatory percentage (51%) not available ?

rootvg quorom always kept disabled.

QUORUM:         1 (Disabled)

Reason behind this is when AIX OS boot and at the time of boot if rootvg having 2 disk and 1 disk from rootvg crashed then OS will never came up,because it not satisfies 51% VGDA rule.so its always good idea to keep mirrored rootvg quorom disabled.



will update new idea and thought on AIX

Thanks !!

Create filesystem in AIX using INLINE and JFS2 log


How To create filesystem in AIX using INLINE and JFS2 log

Method 1: INLINE Log

Identify Volume group on which we going to create Logical volume "testlv".
Make sure that volume group having enough physical partition free to create logical volume(LV).

Here Volume group is datavg


 

mklv -y testlv -t jfs2 datavg

crfs -v jfs2 -d testlv -m /test -a logname=INLINE -A yes

mount /test


Method 2:
Using JFS2 log

mklv -y testlv1 -t jfs2 datavg

mklv -y testloglv -t jfs2log -a e -r n datavg 1

mount /test1

Difference between JFS2 log and INLINE
  • JFS2 log support many Filesystems.
  • every Filesystem have 1 INLINE log
  • if we have several busy Filesystem and we having JFS2log which support these FS,then there is chances of performance bottleneck, to avoid this INLINE log is good option where every filesystem can have 1 inline.

Friday, June 15, 2018

Useful AIX command alt_disk_copy

Useful AIX command alt_disk_copy command

This command clones existing OS copy to other disk of same size.
other application of this command is while cloning admin also do AIX TL upgrade.

some good example with explanation of alt_disk_copy


1.alt_disk_copy -d hdisk1 -b update_all -l /home/AIX72TL02

above command will clone existing OS to hdisk1 and after successful cloning update the OS on cloned disk .

after successful cloning and AIX TL update on new disk ,bootlist has been changed to new disk.

2.alt_rootvg_op -X old_rootvg

After successful booting from newly cloned disk  ,if admin wants to remove old_rootvg then above command is useful.

**here my suggestion is after cloning and AIX TL update keep old_rootvg for 3-4 week .if everything is working fine then admin can remove old_rootvg.


3.Clone AIX OS to hdisk1.
alt_disk_copy -d hdisk1 

some time situation arise where we need to include multiple disk in rootvg ,so in this sitiation how alt_disk_copy will work

Ans:

 alt_disk_copy -d "hdisk5 hdisk6" -b update_all -l /AIX72TL02

so above command will clone AIX 7.2 on hidsk5 and hdisk6 and then update to AIX 7.2 TL 02.


# alt_disk_copy -d "hdisk4 hdisk5"   

clone rootvg on 2 hdisk4 and hdisk5


Below figure show illustration of alt_disk_copy in AIX


                                               


Thanks

will continue writing new ideas on AIX alt_disk_copy





Sunday, June 10, 2018

df command in hang state on AIX two node cluster .

df command in hang state on AIX node


Incident:

on AIX two node hacmp cluster ,when we executed df -gt command , in command output observed that some nfs mount was missing and command is not exiting and in hang state.
because of this TSM backup for AIX node was failing.

Analysis:
After analysis found that one filer mount is missing on server and AIX cluster node was trying to mount it.we checked nmon log file and also /etc/filesystems to find missing mount entry.

solution :

forcefully umounted that filer and after that df -gt works and also TSM backup also worked
after that requested filer access to storage team which was not accessible.

umount -f /nfs-mountpoint  and then TSM backup and df -gt also working fine.

After doing analysis of df -gt hang issue we also found that at Firewall level there was rule missing for communication between AIX server and filer ,so to resolve  issue at network level Firewall rule need to be implement and need to mount again to solve this issue.

df command may hang on AIX NFS clinet when NFS server is down or crashed from where file-system exported to client.

Also want to discuss on mount type in AIX.there are two types of mount 
1.HARD
2.SOFT

so here question is which one is better .As per my knowledge and experience soft mount is the best option while doing NFS mount. generally these two parameter define that if there is nfs mount crash or mount point is not accessible then how nfs client react.

why soft mount is better ??

 AIX node tries until timeout value reach ,but in hard mount it there is no  timeout value defined so AIX server try indefinitely ,so in this situation system performance may degrade.


Thanks !!!!!!

Saturday, June 9, 2018

Assign root privilege to normal user using sudoers on AIX

Assign root privilege to normal user using sudoers file.

Unix root user is master of all user.but sometime situation demand that other user also need access of command which are only executed by root user .

Here /etc/sudoers file come in picture. this configuration file containing stanza for user and their access right.visudo is the command used for editing  /etc/sudoers file.


# User privilege specification
root    ALL=(ALL) ALL
oracle  ALL=(ALL) NOPASSWD:ALL
webuser  ALL=(ALL) NOPASSWD:ALL

In above yellow highlighted text user oracle and webuser able to execute all root user command without entering root password.

Following are some example where normal  user provided root command access.

If admin wants to provide poweroff command access to user test,then following will be the stanza in /etc/sudoers.
 test ALL=(ALL) NOPASSWD: /sbin/poweroff

Default log file for sudo log

Defaults logfile=/var/adm/sudo.log