LVM and VxVM

script to verify root disk mirrors on hp-ux 11.11

 
jmckinzie
Super Advisor

script to verify root disk mirrors on hp-ux 11.11

Does anyone happen to have a script that will verify root disks are mirrored?

Looking for something like this as the output.

I am just not sure where to start on this one as i have several servers...some using Vxvm and some using LVM.

servername -> OK (if they are mirrored)
servername -> FAIL (if they aren't correctly mirrored.)

Thanks in advance.
5 REPLIES 5
Doug O'Leary
Honored Contributor

Re: script to verify root disk mirrors on hp-ux 11.11

Hey;

Here's what I use:


#!/bin/ksh

Host=$(hostname)
vg=${1:-vg00}

for lv in $(vgdisplay -v ${vg} | grep -i 'lv name' | awk '{print $NF}')
do
mc=$(lvdisplay ${lv} | grep -i 'mirro copies' | awk '{print $NF}')
stat=$(lvdisplay ${lv} | grep -i 'lv status' | awk '{print $NF}')
printf "%-8s %-25s %-15s " ${Host} ${lv} ${stat}
[[ ${mc} -gt 0 ]] && echo "mirrored" || echo "NOT MIRROED"
done
#eof

HTH;

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Steven E. Protter
Exalted Contributor

Re: script to verify root disk mirrors on hp-ux 11.11

Shalom,

The script is good, but one caveat. The only way to be sure the mirror is complete is to boot off it.

lslifs and other information should be displayed

lvlnboot -v
another very good idea as well.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
jmckinzie
Super Advisor

Re: script to verify root disk mirrors on hp-ux 11.11

Any scripts for veritas?
Jim Walls
Trusted Contributor

Re: script to verify root disk mirrors on hp-ux 11.11

I don't have anything for veritas... but the attached is a script we run out of Nagios to check our boot discs.

The script emits an appropriate return message and returns 0 if all is OK, 1 for a warning and 2 if summat is deemed to be fatal.

VK2COT
Honored Contributor

Re: script to verify root disk mirrors on hp-ux 11.11

Hello,

Depending on the VxVM version
and the bundles you have installed:

Option 1

Veritas Storage Expert rule vxse_rootmir can
be used to confirm that the root mirrors are set up correctly.

# vxse_rootmir check

Option 2

Find the name of boot data group (normally "rootdg" BUT not compulsory any more):

# vxdg bootdg

List status of boot data group, say called
"bdg":

# vxdg list bdg

Easy to script it and extract lines with
"invalid", "offline", "disabled", "detached",
and similar...

Also, you can use commands:

# vxprint -g bdg -ht

# vxinfo -g bdg

I can probably find some scripts that I wrote over many years (I am not at home now).

One of the many courses I teach is Veritas
Volume Manager. I have been using it for
many years now.

In the HP Edu labs in Australia I actually
have HP-UX servers that run VxVM since of
HP-UX admins normally know LVM only :)

c) A simple (albeit old), Shell script is here:

http://www.scribd.com/doc/3241406/Veritas-Volume-Manager-status-checker

d) I also enclose one of Nagios plugins for
Veritas Volume Manager checks.

This should suffice :)

Cheers,

VK2COT
VK2COT - Dusan Baljevic