SAN disk path health check script using diff command UNIX
Here following script will be helpful during SAN switch activity, where AIX admin involved for health check of disk before and after activity.
=============================================
step 1: create directory in /tmp "health_check_disk"
#cd /tmp
#mkdir health_check_disk
Step 2:
create 2 file with following name
#cd /tmp/health_check_disk
#touch s1 s2
s1===>contain path information for all physical volume on AIX server
s2===>will contain path information for all physical volume on AIX LPAR.
step 3:
check content of s1 file
#cat s1
Enabled hdisk0 fscsi0
Enabled hdisk0 fscsi1
Enabled hdisk1 fscsi0
Enabled hdisk1 fscsi1
Enabled hdisk2 fscsi0
Enabled hdisk2 fscsi1
Enabled hdisk3 fscsi0
Enabled hdisk3 fscsi1
now we will see actual script how it create lspath data before SAN activity.
------------------------------------
for i in `lspv |awk '{print $1}'`
do
lspath -l $i >> s1 //Create s1 file with pv path information
done
----------------------------------
==========================
lspath data after SAN activity
----------------------------------
for i in `lspv |awk '{print $1}'`
do
lspath -l $i >> s2 Create s2 file with pv path information
done
----------------------------------
Now AIX admin need to perform "diff" command execution on both file
#diff s1 s2 // If this command return nothing then no paths is failed ,missing or defined state
#echo $? //return 0 then no paths change happened both s1 and s2 file same
if above command return disk output with name path information then path is changed after AN activity so AIX admin need to correct those path using "chpath".
for example if after SAN team san switch migration some path got faulty then s2 file will contain following failed path
#cat s2
Enabled hdisk0 fscsi0
failed hdisk0 fscsi1
Enabled hdisk1 fscsi0
failed hdisk1 fscsi1
Enabled hdisk2 fscsi0
failed hdisk2 fscsi1
Enabled hdisk3 fscsi0
failed hdisk3 fscsi1
When AIX admin run "diff" command on both file it will throw output with line number and file content. it also display what was content of s1 file and what difference now it having. so AIX admin easily identify those hdisk and correct their path
#diff s1 s2
Output:
It will show that s1 and s2 file has diffrence and show what was that diffrence
like hdisk0 fscsi1 path got failed and that was in enabled state before SAN team activity.
Thanks !!
No comments:
Post a Comment