Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 432824

Summary: LVM2 Documentation should explain "lvcreate --target RAID1" vs "--mirrors"
Product: [OLD] Docs on Reporter: Forza <forza>
Component: Other documentsAssignee: Docs Team <docs-team>
Severity: enhancement CC: bruce, forza
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---

Description Forza 2012-08-26 09:24:17 UTC
LVM2 natively used device-mapper and its RAIDx modules. 

It is a very common setup to run LVM ontop of MD raid these days. I believe the reason is simply that users do not know about the --target RAIDx option, most likely because the original documentation is very old and not very thorough (

Reproducible: Always

Steps to Reproduce:
For example, I have two physical disks /dev/sdb2 /dev/sdc2:

# lvcreate -n userDataRaid -L 300G --type raid1 serverStorage -v
# dmesg

[91006.274995] device-mapper: raid: Superblocks created for new array
[91006.286605] md/raid1:mdX: not clean -- starting background reconstruction
[91006.286613] md/raid1:mdX: active with 2 out of 2 mirrors
[91006.286619] Choosing daemon_sleep default (5 sec)
[91006.286669] created bitmap (300 pages) for device mdX
[91006.372951] mdX: bitmap file is out of date, doing full recovery
[91007.032120] mdX: bitmap initialized from disk: read 19 pages, set 614400 of 614400 bits
[91007.199941] md: resync of RAID array mdX
[91007.199956] md: minimum _guaranteed_  speed: 1000 KB/sec/disk.
[91007.199961] md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for resync.
[91007.199971] md: using 128k window, over a total of 314572800k.
[95111.688061] md: mdX: resync done.
[95111.756975] RAID1 conf printout:
[95111.756991]  --- wd:2 rd:2
[95111.757000]  disk 0, wo:0, o:1, dev:dm-6
[95111.757005]  disk 1, wo:0, o:1, dev:dm-8

# lvs -a -o+devices
  userDataRaid            serverStorage mwc-ao 300,00g                                  100,00         userDataRaid_rimage_0(0),userDataRaid_rimage_1(0)
  [userDataRaid_rimage_0] serverStorage -wc-ao 300,00g                                                 /dev/sdc2(140801)
  [userDataRaid_rimage_1] serverStorage -wc-ao 300,00g                                                 /dev/sdb2(140801)
  [userDataRaid_rmeta_0]  serverStorage -wc-ao   4,00m                                                 /dev/sdc2(140800)
  [userDataRaid_rmeta_1]  serverStorage -wc-ao   4,00m                                                 /dev/sdb2(140800)

lvcreate --type RAID1 will create a striped mirroed target, whereas --mirrror 1 will create a mirrored volyme where reads will only happen from the primary volume.

Performance with RAID1 target is much better.
Comment 2 Sven Vermeulen (RETIRED) gentoo-dev 2013-07-23 14:35:29 UTC
This document has been marked as obsolete due to insufficient resources. However, a more active document can be found on the Gentoo Wiki at We welcome any contributions on this guide and recommend you create an account (if you do not have one already) and make the adjustments to the article as needed. In case of doubt, use the Talk page to discuss potential changes before applying them.

If needed, the wiki-style version of the old document is available at so any previously existing content can, if needed, be reused on the wiki.