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?

1
  • 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? Commented Mar 30, 2022 at 13:30

5 Answers 5

4

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.

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.

6

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

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.

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.

1
  • 1
    I don't think this guarantees the log will be stored on your tiny physical volume. In fact, I believe LVM may even store some of your mirrored extents in the tiny physical volume (i.e. on the same disk), which would generall defeat the purpose of mirroring. PS I know this was a long time ago but just trying to help others who may find this answer etc. PPS LVM documentation is not really clear on where data is mirrored and where the log is stored exactly. Commented Feb 20, 2023 at 3:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .