Page 1 of 1

[SOLVED] LVM / MDADM issue

Posted: 2014/02/18 09:20:07
by charliemops
Hi all,

I have a 2 disk mirror raid built with mdadm lying on a LV:

/dev/sda -> /dev/sda1 /dev/sda2
/dev/sdb -> /dev/sdb1 /dev/sdb2

/dev/md0 106MB boot partition formed by /dev/sda1 & /dev/sdb1
/dev/md1 159,9GB root partition formed by /dev/sda2 & /dev/sdb2

# lvs
LV VG Attr LSize
rootvol vglinux -wi-ao 100.00G
swapvol vglinux -wi-ao 13.66G


After some problems with power supply, which may be the causes of the SATA bus reset, I've found this message at boot:

Setting up Logical Volume Management: Found duplicate PV CKbmcEG1VfGppXJpRK1K6Oqes2KRi6mv: using /dev/md127 not /dev/md1
2 logical volume(s) in volume group "vglinux" now active
[...]
[...]
Starting monitoring for VG vglinux: Found [...same message...]
2 logical volume(s) in volume group "vglinux" monitored

Then the system boots up and I have my mirror degraded as follows:

#cat /proc/mdstat
md126 : active raid1 sda1[1]
104320 blocks [2/1] [_U]

md127 : active raid1 sda2[1]
156175808 blocks [2/1] [_U]

md0 : active raid1 sdb1[0]
104320 blocks [2/1] [U_]

md1 : active raid1 sdb2[0]
156175808 blocks [2/1] [U_]


Additional infos:
# uname -a
2.6.18-194.el5


How can I fix this (without losing anytingh :D) ?

Thank you,
Steve

Re: LVM / MDADM issue

Posted: 2014/02/18 09:36:17
by TrevorH
Lovely! First thing to do is to work out which of the arrays is actually in use. You'll see that md126 is the other half of md0 and md127 is the other half of md1. You need to work out which of md0/md126 and md1/127 are really used then stop the other one then add the component devices from each back into the correct array. You also have to hope that it's not using both!

Re: LVM / MDADM issue

Posted: 2014/02/18 09:52:27
by charliemops
Hi TrevorH,
thank you for your reply.
I think the system is using /dev/md0 because it is correctly mounted:

/dev/md0 99M 16M 78M 17% /boot
/dev/mapper/vglinux-rootvol
99G 3.1G 91G 4% /

The last one is the LV that should be using /dev/md1 but if I launch an lvs I obtain:

# lvs
Found duplicate PV CKbmc[...blah blah...] : using /dev/md127 not /dev/md1
LV VG Attr LSize
rootvol vglinux -wi-ao 100.00G
swapvol vglinux -wi-ao 13.66G


Is this enough to know that /dev/md127 is in use? Is there another way to check it?

*[EDIT]
I've just gave the pvs command which returns:

# pvs
Found duplicate [...the same as above]
PV VG Fmt Attr VSize VFree
/dev/md127 vglinux lvm2 a- 148.94G 35.28G


Can you give me some indication where to start to correct this issue? Thank you!

Re: LVM / MDADM issue

Posted: 2014/02/18 12:55:10
by TrevorH
Looks like you have the worst of both worlds. Yes, /boot is using /dev/md0 but the pvs output error seems to show that it is using /dev/md127 and not /dev/md1. So.. my first step would be to backup anything I couldn't afford to lose... ;-) Then I would stop the /dev/md126 array using `mdadm --stop /dev/md126` and then repeat for /dev/md1. If they stop successfully then I would add the component devices from each of those into their counterparts and let them rebuild - but do it one at a time and let the rebuild finish for the first before you attempt the second. Something like `mdadm --add /dev/md0 /dev/sda1` then when that has finished, add /dev/sdb1 into /dev/md127 and let that rebuild.

Backup first!

Better also verify that I got the devices right and that what I say makes sense!

Re: LVM / MDADM issue

Posted: 2014/02/18 15:18:51
by charliemops
What you say DO makes sense!

I've stopped the raid /dev/md126 (sda1) and added the /dev/sda1 to its real mirror device /dev/md0. This device hosts the boot partition, so I rebooted to find out my destiny :D. It started without problems and the /dev/md126 disappeared. The rebuild of the array has been immediate due to the small size of partition.
So I did the same with /dev/md127- stop and re-add of /dev/sda2 to /dev/md1. This time the rebuild of the array has been a little longer, but rebooting I found again no problems.

After some other reboot and tests I can say this issue is SOLVED.

Thank you