2

I'm running Ubuntu 12.04 and have just added 2 new hard drives into my server. The idea being that I would create a volume group that would include them and create a bunch of logical volumes on them that would be mirrored.

I've partitioned the 2 drives to have a a primary partition on each of type 8E (LVM):

/dev/sdc1            2048  3907029167  1953513560   8e  Linux LVM
/dev/sdd1            2048  3907029167  1953513560   8e  Linux LVM

Then added them as physical devices, created a volume group and added the to the volume group:

--- Volume group ---
VG Name               vmdata
System ID             
Format                lvm2
Metadata Areas        2
Metadata Sequence No  8
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                0
Open LV               0
Max PV                0
Cur PV                2
Act PV                2
VG Size               3.64 TiB
PE Size               4.00 MiB
Total PE              953862
Alloc PE / Size       0 / 0   
Free  PE / Size       953862 / 3.64 TiB
VG UUID               2zdfc7-1fj2-kMdy-7OUq-eadi-AsF2-Sujbes

--- Physical volumes ---
PV Name               /dev/sdc1     
PV UUID               kAU93m-4S5V-MD1V-EkTA-m0u7-bmQn-3pyVmk
PV Status             allocatable
Total PE / Free PE    476931 / 476931

PV Name               /dev/sdd1     
PV UUID               erVnaJ-vp5S-0LHW-oRSx-joer-VXPX-KG0uDb
PV Status             allocatable
Total PE / Free PE    476931 / 476931

When I try to create a new logical volume of type RAID 1 it fails:

$ lvcreate --type raid1 -m 1 -L 64G -n fred vmdata
WARNING: Unrecognised segment type raid1
Insufficient suitable allocatable extents for logical volume : 16384 more required
Unable to allocate extents for mirror(s).

When I try to create it as a plain mirror it also fails:

$ lvcreate -m 1 -L 64G -n fred vmdata
Insufficient suitable allocatable extents for logical volume : 16384 more required
Unable to allocate extents for mirror(s).

What am I missing?

1
  • It's been a while since I set up a LVM system, but do you perhaps need to activate the VG (vgchange -ay vmdata) before creating the LV? May 18 '14 at 0:04
1

Make sure that the RAID array is in an active state.

Example

$ lvscan
  inactive          '/dev/kodak_vg/lvm0' [149.00 GB] inherit

So I ran this command to activate it:

$ vgchange -ay
  1 logical volume(s) in volume group "kodak_vg" now active

Re-running lvscan showed the LV as active now:

$ lvscan
  ACTIVE            '/dev/kodak_vg/lvm0' [149.00 GB] inherit

Valid segment types

Based on the error it sounds like perhaps something is amiss with your segment types.

WARNING: Unrecognised segment type raid1

You can use this command to find out what segment types are valid.

$ sudo lvm segtypes
  striped
  zero
  error
  free
  snapshot
  mirror
  raid1
  raid10
  raid4
  raid5
  raid5_la
  raid5_ra
  raid5_ls
  raid5_rs
  raid6
  raid6_zr
  raid6_nr
  raid6_nc
  thin-pool
  thin

Ubuntu 12.04's version of LVM?

The ability to create RAID's within LVM is a fairly new-ish feature, so I would suspect that 12.04's version of LVM just doesn't support this segment type.

What to do?

If this is the issue all is not lost. You can simply setup the LVM VG (Volume Group) on top of a MD (mdadm) RAID1.

without LVM, just MD with LVM + MD

References

2
  • I thought about vgchange -ay, too but didn't say anything because IMHO the output VG Access read/write doesn't make sense for an inactive VG. May 18 '14 at 22:50
  • @HaukeLaging - yeah I wasn't sure either, I hadn't seen that msg assoc. w/ that error msgs either but is a good place to start in the debugging, IMO, just to be on the safe side. The use of LVM RAID is new to me, I've always done the mdadm + LVM, so the segment types was news to me.
    – slm
    May 18 '14 at 23:34
1

Turns out 12.04 didn't support raid1, but 14.04 has added it.

When I as trying to create a plain mirror (m 1) it didn't work then as it needed a 3rd volume for the mirror log.

Upgrading to 14.04 fixed it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.