Rootvg mirroring check script

#!/usr/bin/ksh
TMP_FILE=/tmp/mirror_check.out
if (( $(lspv| grep -cw rootvg) > 1 )); then
        lsvg -l rootvg | awk 'NR > 2 && $2 !~ /^sysdump$/ { if ($3 == $4) {print $0} }' >> $TMP_FILE
        NON_MIRR=`wc -l < $TMP_FILE`
        if (( $NON_MIRR != 0 )); then
                echo "unmirrored LVs found:"
                echo
                cat $TMP_FILE
        fi
fi

The original code was written by zaxxon.

The above code has a flaw, works when only one sysdump device exists, if 2 dump device exists, it says as not mirrored. Please check and help to update the script

Welcome!

Please wrap your code in triple-backticks markdowns! (Use the symbols at the top of the edit area. I edited your post and did it.)

At a first glance it looks okay. The condition $2 !~ /^sysdump$/ skips all lines where the 2nd field is sysdump.

I do not have an AIX at hand; maybe you can provide output of the problematic
lsvg -l rootvg
Wrapped in markdowns please!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.