Sunday, May 29, 2022

How to delete old file using find command on AIX operating system

Delete log files on AIX operating system which are older than 365 days.

Command to list these files
#find /oracle/log -name "*.log" -mtime +365 -exec ls -lrt {} \;

#find /oracle/log -name "*.txt" -mtime +365 -exec ls -lrt {} \;

Above command will list which are older than 365 days.

If UNIX AIX admin wanted to remove them after approval from Oracle team he can remove by following command

#find /oracle/log -name "*.log" -mtime +365 -exec rm {} \;

find /oracle/log -name "*.txt" -mtime +365 -exec rm {} \;

Same command AIX admin can use different criteria like 100 days, 200 days old file housekeeping,by modifying -mtime .

Thanks.

Thursday, May 19, 2022

create file backup using script on AIX operating system.

Script

for inputfile in test1 test2 test3 test3
do
cp $inputfile ${inputfile}.bkp
echo $inputfile backup created successfully
Sleep 2
done 

Monday, May 2, 2022

How To replace faulty ethernet adapter Which is part of shared ethernet on AIX VIO, without reconfiguring SEA

 Replace faulty ethernet adapter Which is part of shared ethernet on AIX VIO, without reconfiguring SEA.

Lets see....

Scenario:

on VIO server version 2.2 one of the 4 port ethernet adapter is faulty and it caused ,SEA in error state.

we provided snap to IBM CE from VIO and IBM confirmed that ethernet adapter is faulty it needs to be replaced.

So following steps IBM recommended:


Steps 1:

Take all prechecks for VIO like ,latest mksysb, viosbr and all necessary health check

step2 :

Make sure that AIX admin have faulty ethernet adapter location details:

lsslot -c pci // Display all Hot hot-plug slots in the system unit.

example 

ent0  10/100 Base-TX Ethernet PCI Adapter  // port 1

ent1 10/100 Base-TX Ethernet PCI Adapter  //// port 2

ent2  10/100 Base-TX Ethernet PCI Adapter // port 3

ent3  10/100 Base-TX Ethernet PCI Adapter // port 4


if admin do #lscfg -vpl ent0 

#lscfg -vpl ent0 // show location of faulty ethernet adapter


step 3:

once location identified and IBM CE in data center ,identify that faulty ethernet adapter using "diag" utility.


#diag-->press enter-->task selection-->hot plug task-->PCI hot plug task-->identify PCI hot plug slot--->select and set to identify mode .


once CE confirm this , admin exit from this window


step4:

failover all SEA to secondary VIO and shutdown VIO

for i in `lsdev -Cc adapter | grep -i shared |awk '{print $1}'`
do
echo "-------shared SEA $i  failover to partner VIO------ "
chdev -l $i -a ha_mode=standby
echo "---------------------"
sleep 2
done

step 5:

Ask IBM CE to replace faulty ethernet adapter

once ethernet adapter is replaced ,activate VIO and do health check.

step 6:

check ethernet adapter is available .then do SEA failback.

for i in `lsdev -Cc adapter | grep -i shared |awk '{print $1}'`
do
echo "-------shared SEA $i  failover to partner VIO------ "
chdev -l $i -a ha_mode=auto
echo "---------------------"
sleep 2
done

check SEA link, by following script

for i in `lsdev -Cc adapter | grep -i shared |awk '{print $1}'`
do
echo "-------shared SEA $i  state priority and active status ------ "
entstat -d $i | grep -i link
echo "---------------------"
sleep 2
done

This way we can replace faulty ethernet adapter . 


Thanks

:)






Change Hitachi disk attribute using shell script on multiple disk on AIX Lpar

 Script:

Step 1 : create list of server on where u wanted to change disk parameter, create this file

on NIM server from where pass wordless ssh is working.

Example


#vi list

test1

test2

test3

test4

test5


:wq


step 2:


Create script to login on each AIX LPAR using following script:

===========================

for i in `cat list`

do

ssh $i

done

===========================


Above script will connect to each server once you sure that you are host where Hitachi disk 

parameter need to change, execute following script.

=======================================================


for i in `lsdev -c disk |grep -i Hitachi |awk '{print $1}'`

do

echo $i

chdev -Pl $i -a hcheck_interval=90 -a timeout_policy=fail_path

done

==============================================================


Once above script executed check parameter changed or not by following script


for i in `lsdev -c disk |grep -i Hitachi |awk '{print $1}'`

do

echo $i

lsattr -El $i -a hcheck_interval,timeout_policy -F attribute=value |xargs

done


Once done type "exit" on AIX LPAR ,then it will prompt for next AIX LPAR.

This way AIX admin can interactively change disk parameter on AIX LPAR

Thanks :)










Sunday, May 1, 2022

Troubleshoot SAS disk drive name using rmdev and cfgmgr on AIX VIO Server

 Today I am going to share my experience for how to change hot  swappable SAS disk drive name change.

Details of scenario:

On one of the VIO server ,had disk drive failure and in AIX errpt its showing as permanent hardware error. so as per IBM suggestion this was faulty disk drive need to be replaced. from VIO end we performed DIAG procedure for replacement of faulty disk drive.

But when new disk was detected it came up with new disk name and that unexpected, because SAS disk have name as "hdisk0" before replacement. so when IBM CE replaced disk it must come up with hdisk0.

#diag      //Diag procedure for SAS disk replacement

-->Select Hot Plug Task.

-->Certify media task

-->Select RAID Hot Plug Devices.

--->Select SAS disk drive location and press enter to "set faulty SAS disk LED in identify mode"

and ASK IBM CE to confirm


--->once IBM CE confirmed press enter and came to previous screen


---->Choose remove and replace and select faulty SAS disk and make disk ready for replacement


---->Once SAS disk is ready for Replacement, ask IBM CE to replace and confirm.

----> Once disk is replaced detect new disk by selecting following menu


"Configure newly detected Device"


How to check SAS disk after replacement:

======================================


#lspv |grep -w "hdisk0"

#lsdev -Cc disk |grep -w "hdisk0"

#bootinfo -s hdisk0

#lscfg -vpl hdisk0


Make sure that new serial number is on newly replaced hdisk0


Troubleshooting we did to solve this issue:

SAS disk name which was faulty: hdisk0  

New disk name after Hot swap replacement using diag: hdisk400

Soution: when we checked where exactly hdisk0 disappeared, we found that hdisk0 is in defined state.

Ran following command:

#rmdev -dl hdisk0

#rmdev -dl hdisk400   // before deleting we make sure that location is correct and its SAS disk

#cfgmgr 


After running above procedure we able to see "hdisk0" in available state on VIO server.


Thanks !!!! :)