-   Linux - Software (
-   -   How to handle if lvm disk fails? (

sluge 12-07-2012 05:05 AM

How to handle if lvm disk fails?

I installed linux using LVM logical volumes in /dev/sda, mirror this logical volumes with /dev/sdb


# pvcreate /dev/sdb2
# vgextend vg_main /dev/sdb2
# lvconvert vg_main/lv_root -m1 -b
# lvconvert vg_main/lv_swap -m1 -b

and removed one of hard drives to check how linux will handle it.

So, linux hands for 2-3 minutes and after it crashed. I'm was suprised-is LVM doesn't support RAID1 mirroring?
Or is it required to make some additional configuration to setup LVM RAID1 mirroring?

MensaWater 12-07-2012 08:14 AM

Linux LVM doesn't do mirroring itself. It also doesn't do multipathing.

You need to to RAID software mirroring metadisk (see mdadm man page as a start) to setup a mirrored device if these aren't multiple paths to the same device. You then use that mirrored device as your PV in the VG rather than using the individual /dev/sd* devices.

You would need to use Linux multipathing (see multipath man page as a start) if these are multiple paths to the same device on an external hardware mirror (e.g. EMC or Hitachi disk array). You'd then present the multipath device as PV rather than the individual /dev/sd* devices.

From what you wrote it sounds like you're not using the latter.

michaelk 12-07-2012 09:42 AM

It really does but I have not personally tried it and so it appears that you followed the correct steps. I can only assume that the steps you posted were completed successfully. In addition depending on the size of your VGs it could take many hours to convert and the -b puts this process in the background. Without knowing if this step has completed successfully trying to check the functionality may not work. What linux distribution / version are you running?

Post the output of the command:
lvs -a -o +devices

sluge 12-09-2012 01:30 AM


Originally Posted by MensaWater (Post 4844532)
Linux LVM doesn't do mirroring itself.

LVM2 supports RAID 0, 1, 5, 6

All times are GMT -5. The time now is 09:50 PM.