11

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 than RAID-1, at least in reading (only single volume being used for reading).
  2. Unreliable on power interrupts (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?

SyRenity
  • 3,159
  • 11
  • 55
  • 79
  • The linked blog shows faster speed for LVM both reading and writing, though cautions that the difference in the read speed may be insignificant given expected variance of measurements. Did you use other sources "found on the internet" for this claim? – Joachim Wagner Mar 30 '22 at 13:30

5 Answers5

6

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.

Avery Payne
  • 14,326
  • 1
  • 48
  • 87
5

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.

Rodger
  • 609
  • 4
  • 6
5

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

gdamjan
  • 150
  • 1
  • 4
5

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.

womble
  • 95,029
  • 29
  • 173
  • 228
1

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.

James
  • 607
  • 7
  • 14