1

I came across an error when I create RAID10 with LVM2.

I have four PVs and when I create LV using this command:

sudo lvcreate --mirrors 1 --stripes 2 -l7630 -n lv0 vg0 --corelog

display the VG, it should be empty,but it has half..

  VG Name               vg0
  System ID             
  Format                lvm2
  Metadata Areas        4
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                4
  Act PV                4
  VG Size               475.94 GiB
  PE Size               16.00 MiB
  Total PE              30460
  Alloc PE / Size       15260 / 238.44 GiB
  Free  PE / Size       15200 / 237.50 GiB
  VG UUID               YNI5YN-o41z-4vb4-FAkf-gUKI-Da77-O0uD3a
Uwe L. Korn
  • 224
  • 1
  • 14
dawncold
  • 23
  • 1
  • 10

1 Answers1

3

Your VG has 30460 total physical extents.

You've told lvcreate to create a LV with 7630 extents.

7630 × 2 = 15260

The output is correct.

(If you're trying to create a RAID10, you probably want to use mdadm to create an actual software RAID10 then use the resulting mdX as a LVM PV)

MikeyB
  • 39,291
  • 10
  • 105
  • 189
  • Why use LVM RAID instead of mdadm? I know mdadm might be more mature (or the tools are) as the RAID "engine" is the same. But do you have other reasons to prefer mdadm? – MrCalvin May 24 '19 at 14:38
  • @MrCalvin Note the date of the answer — it'll have its 7th birthday this year. LVM RAID was much less mature back then. – derobert Jun 11 '19 at 22:17
  • Yea, but I still looking for good arguments for switching to LVM RAID instead of mdadm :-P – MrCalvin Jun 13 '19 at 05:50