Operating System - HP-UX
1829683 Members
4723 Online
109992 Solutions
New Discussion

How to list mirrors of dirves

 
SOLVED
Go to solution
Ratzie
Super Advisor

How to list mirrors of dirves

How can I tell if a drive has been successfully mirrored?
5 REPLIES 5
Ermin Borovac
Honored Contributor
Solution

Re: How to list mirrors of dirves

Mirroring is done on logical volume level. You can check if logical volume has been successfully mirrored with lvdisplay (Mirror copies should be 1 or 2).

# lvdisplay /dev/vg00/lvol10
--- Logical volumes ---
LV Name /dev/vg00/lvol10
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 1
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 504
Current LE 63
Allocated PE 126
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default
Hazem Mahmoud_3
Respected Contributor

Re: How to list mirrors of dirves

Ermin is correct. You can tell by the lvdisplay command. If you find that it was not mirrored, make sure you have MirrorDisk installed. This needs to be installed to perform mirroring. Execute "swlist | grep Mirror".
Mirroring is performed with the lvextend command using the -m option.

-Hazem
Uttamkumar Dravidam
New Member

Re: How to list mirrors of dirves

do lvlnboot -v /dev/vg00.

you will see mirrored drives for /stand,/root,swap,dump.

and as stated earlier do lvdisplay -v /dev/vg00/lvol10 | more

I hope this helps...
Sunil Sharma_1
Honored Contributor

Re: How to list mirrors of dirves

In LVM Mirroring is done on volume basis not on disk basis. You can see this info using lvdisplay command.

If you want to see wheather mirroring is proper or not (fully sync or not) use below command

lvdisplay -v /dev/vgnn/lvolmm |grep stale |wc -l

Output of this command should be zero if volume is fully syncronise.

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
Geoff Wild
Honored Contributor

Re: How to list mirrors of dirves

Here's a a couple of scripts for you:

# cat chkstaledsks
#!/bin/sh
# Identifies and displays stale extends on all system volume groups.
# Useful to determine defect harddisks in mirrored enviroments
# Geoff Wild

vgdisplay -v | awk '/LV Name/ { print $3 }' | xargs lvdisplay -v | grep -i -e "lv name" -e "lv status" -e stale -e '?'



# cat chkdisks
#! /bin/sh

# Check the status of HP disks. i

# Currently this just checks for mirrored disks. Even this is not complete;
# while the script does verify that logical volumes are mirrored to different
# disks, it does not verify that logical volumes are mirrored across
# controllers.

VERBOSE=0
while getopts g:v flag
do
case $flag in
v)
VERBOSE=1
;;
*)
print "Usage: `basename $0` [-v] [vgs]"
print "\tIf no VGs are listed all will be checked."
exit 1
;;
esac
done

shift $((OPTIND -1))
VGs="$*"

TMPF=/tmp/lv.out.$$
trap "rm -f $TMPF; exit 1" 1 2 3 15

# First, print the headers. I should have a flag to suppress this.

printf "%-30s\t%-35s %-10s\n" "Logical Volume" Filesystem "Mirrored?"
printf "%-30s\t%-35s %-10s\n" "--------------" ---------- ---------

# First, generate the list of volume groups.
ALLVGs=`/usr/sbin/vgdisplay 2>/dev/null | grep 'VG Name' |\
awk '{print $3}' | sed 's,/dev/,,'`

VGs=${VGs:-$ALLVGs}

for vg in $VGs
do
LVs=`/usr/sbin/vgdisplay -v $vg | grep 'LV Name' | awk '{print $3}'`

for lv in $LVs
do
# Yuck, there has got to be a better way to do an
# anchored search. Yet I don't want to use perl.
str=`echo $lv | sed 's,/,.,g'`
fs=`awk '$1 ~ /^'$str'$/ {print $2}' /etc/mnttab`

# Check for mirrored disks. This is more complicated than
# I thought. There are cases where the LEs are mirrored to
# PEs on the same disks.
ismirr="no" # assume not mirrored
reason="" # but no reason

/usr/sbin/lvdisplay -v $lv > $TMPF
nummirr=`grep 'Mirror copies' $TMPF | awk '{print $3}'`
if [ $nummirr -gt 0 ]
then

# Check for volumes mirrored on the same disk,
# that is, where the number of PEs is more than
# the number of LEs.
badLEs=`grep '^ */dev/' $TMPF | awk '$2!=$3 {print $0}'`
if [ "x$badLEs" = "x" ]
then
ismirr="yes"
else
ismirr="no"
reason="$lv is mirrored on same disk."
fi
else
reason="$lv mirrored copies is 0."
fi

# Anything else to check for? Controller!
printf "%-30s\t%-35s %s\n" "$lv" "$fs" "$ismirr"

# If requested, explain why this disk is not mirrored
if [ $VERBOSE -gt 0 -a "$ismirr" = "no" ]
then
print "\t$reason"
fi
done
done

# Cleanup
/bin/rm -f $TMPF



Rgds...Geoff


Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.