Sunday, January 23, 2011

LVM mirroring VS RAID1

Hi.

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:

  1. Slower then RAID-1, at least in reading (as only single volume being used for reading).
  2. 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.

    From womble
  • one actually requires a 3rd disk for storing the LVM log

    In one setup I partitioned a disk into one main physical volume and another tiny physical volume for the LVM log. If I ever lost that disk I would of course lose the mirror log, but that's OK because when the volume degraded to unmirrored it would no longer need the log.

    From James
  • 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.

    From Rodger

0 comments:

Post a Comment