1833653 Members
3792 Online
110062 Solutions
New Discussion

Re: disk mirroring

 
SOLVED
Go to solution
Franky Leeuwerck
Frequent Advisor

disk mirroring

Hi there,

Can anyone tell how I can detect what disks are mirrored, and what disks aren't ?

Thanks in advance

Franky
6 REPLIES 6
Stefan Farrelly
Honored Contributor
Solution

Re: disk mirroring


With LVM mirroring is now really on Logical volume basis, not disk basis. Each Logical volume can span multiple disks or only part of one disk, so you need to do it using lv commands.

For each lvol in each /dev/vg* directory do a lvdisplay on it and grep for mirror;

eg. lvdisplay /dev/vg00/vlol1 | grep -i mirror

If it comes back with a "Mirror copies 1" then its mirrored. Now do an lvdisplay -v on the same LV (lvdisplay -v /dev/vg00/lvol1 | more) and it will display the disks this lvol is on, in 2 colums, the first being the primary disk and the second the mirror disk. Look at the entire display as each lvol may span many disks and thus mirrored on many different disks.

Im from Palmerston North, New Zealand, but somehow ended up in London...
Scott_14
Regular Advisor

Re: disk mirroring

One other way, if you wanted to use SAM, to see all your lvls, you will see the number of mirror copies indicated also next to each one.
Franky Leeuwerck
Frequent Advisor

Re: disk mirroring

Thanks for the quick replies. This solves my question.
Franky
James R. Ferguson
Acclaimed Contributor

Re: disk mirroring

Hi Franky:

Here's a simple script that automates the process of enumerating the number of mirrors for each logical volume in each volume group on a server:

#!/usr/bin/sh
for LV in `vgdisplay -v|awk '/LV Name/ {print $3}'`
do
lvdisplay $LV|awk -v LV=$LV '/Mirror copies/ {print LV,$3}'
done
exit 0
#.end.

Call the script 'my.sh' and when you run it, you will see something like:

# ./my.sh
/dev/vg00/lvol1 1
/dev/vg00/lvol2 1
/dev/vg00/lvol3 1
/dev/vg00/lvol4 1
/dev/vg00/lvol5 1
/dev/vg00/lvol6 1
/dev/vg00/lvol7 1
/dev/vg00/lvol8 1
/dev/vg00/lvol9 1
/dev/vg02/lvol1 0
/dev/vg03/lvol1 0
/dev/vg03/lvol2 0

Regards!

...JRF...
Ragni Singh
Super Advisor

Re: disk mirroring

Hi Guys,

I was just lookng at James mirroring scripts and being that I'm very new to Unix, can somepne possibly explain to me what each line there means please. Help will be greatly appreciated.
Hamdy Al-Sebaey
Regular Advisor

Re: disk mirroring

Franky,
I agree with Stefan's way,I used it in the past.

Regards,
Hamdy
Thanks for sharing knowledge