LVM mirroring VS RAID1
Having learned a bit about LVM mirroring, I thought about replacing the current RAID-1 scheme I'm using to gain some flexibility.
Problem is that according to what I found on the Internet, LVM is:
- Slower then RAID-1, at least in reading (as only single volume being used for reading).
- Non-reliable on power interrupts, and requires disk cache disabling for prevention of data loss.
http://www.joshbryan.com/blog/2008/01/02/lvm2-mirrors-vs-md-raid-1/
Also it seems, at least to several setup guides I read (http://www.tcpdump.com/kb/os/linux/lvm-mirroring/intro.html), that one actually requires a 3rd disk for storing the LVM log. This makes the setup completely unusable on 2 disks installations, and lowers the amount of used mirror disks on higher amount of disks.
Can anyone comment the above facts, and let me know his experience of using LVM mirroring?
Thanks.
I've never used LVM mirroring, but the info you've dug up seems reasonable from what I know of LVM. I'd stick with MD RAID-1, myself.
LVM mirrors are for replication of a logical volume to a different physical volume. It's essentially meant to "move the data to a different disk". The mirror is then broken and the old location of the data freed for use; the existing data is utilized at the new location instead.
RAID mirrors are for providing a safeguard against single-drive hardware failures. It's essentially meant to "keep your data from being lost if a disk dies".
Stick with RAID over LVM mirroring for your purposes.
Write cache disabling is always required if you want to minimise the chances of data loss when you have a power cut. It doesn't matter if you have md RAID, LVM, or nothing at all. Your drive can have 16 - 64 MB in the cache on a modern device, and it will dissapear.
Unless you value speed over correctness, I'd switch write caching off on drives.
Barriers are a kernel techniue to try and improve the chances of data getting to disk. Up until 2.6.29 LVMs ignored them. Now LVM honours barriers (if and only if you have a linear target and a new enough kernel) so if you want the flexibility of LVM and barrier support your best bet is barrier-on-md RAID.
New versions of LVM can use the same raid implementations from MD.
Browsing the history, raid4/5/6 seems to appeared in the kernel in 2.6.38 and raid0/1 sometimes between that and 3.1
Supported also from RHEL 6.1 (raid0/raid1) and from RHEL 6.3 (raid4/5/6) https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Logical_Volume_Manager_Administration/LVM_overview.html