lvm mirroring doesn't work in Edgy/Feisty

Bug #121527 reported by Ketil Malde
This bug report is a duplicate of:  Bug #120792: lvcreate fails with mirror raid1. Edit Remove
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lvm2 (Debian)
New
Unknown
lvm2 (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: lvm2

I am unable to make lvm mirroring work with Feisty or Edgy.

Any attempts to use -m1 with 'lvcreate' or 'lvchange' results in a message about not being able to allocate extents. E.g:

  eia:~ % sudo modprobe dm-mirror
  eia:~ % sudo lvcreate -m 1 -L1G -n test /dev/Ubuntu
    Not enough PVs with free space available for parallel allocation.
    Consider --alloc anywhere if desperate.
  eia:~ % sudo lvconvert -m 1 /dev/Ubuntu/tmp
    Insufficient suitable allocatable extents for logical volume : 512 more required

The VG consists of two disks, one recently added, and about 25% of it allocated to LVs.

(See also #120364 - if it's not supposed to work, it should be documented as such)

-k

Revision history for this message
Ketil Malde (ketil-ii) wrote : Corresponding bug in Debian

Apparently, the broken LVM is inherited from Debian:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=394333

Changed in lvm2:
status: Unknown → New
Revision history for this message
Ketil Malde (ketil-ii) wrote :

#129285 might be another duplicate of this?

-k

Revision history for this message
Greg Copeland (gtcopeland) wrote :

This is not a bug but a user failure. I'm not an Ubuntu user but I just happened to stumble on this while looking for something else so I thought I would help you guys close this bug. As such, I've not tried to create a mirror under Ubuntu. Just the same, the user instructions above will fail on all LVM2 platforms as it is not being used properly.

To create an LVM mirror you MUST have THREE PVs available! From my limited experience, it appears the third PV (the log) only requires 4MB be available so creating a larger PV is nothing but a waste. The third PV can be created on a third disk or on one of the mirror'd disks (if partitions are used). Loss of the log only affects *cross-boot* synchronization/restoration so it is safe to use a third disk at the cost of safe mirror de-synchronization. I say safe because it will create the same potential issues as simply losing a mirrored disk or LV. Personally, I'd rather tie it to a disk involved in the mirror but performance is likely slightly better using a third disk. Below you can see I'm using two disks, not three as I believe this eases the failure detection and recovery picture slightly.

[root@localhost ~]# lvs -a -o +devices
  LV VG Attr LSize Origin Snap% Move Log Copy% Convert Devices
  home mirror1 mwi-ao 200.00G home_mlog 24.47 home_mimage_0(0),home_mimage_1(0)
  [home_mimage_0] mirror1 Iwi-ao 200.00G /dev/sdb6(0)
  [home_mimage_1] mirror1 Iwi-ao 200.00G /dev/sdc6(0)
  [home_mlog] mirror1 lwi-ao 4.00M /dev/sdb5(0)

As you can see above, I'm rebuilding my mirror as we speak. The mirrored LV is home, in the mirror1 VG. It has three PVs in use; /dev/sdb6, /dev/sdc6 (to be 200G - mirrored), and /dev/sdb5 (the log).

To get the above do the following but with your own devices.
pvcreate /dev/sdb5 (>4MB log PV)
pvcreate /dev/sdb6 (mirror PV)
pvcreate /dev/sdc5 (>4MB log PV - redundant and not immediately used - used for recovery, if needed)
pvcreate /dev/sdc6 (mirror PV)

# The /dev/sdc5 is not required is is strictly optional - it also makes partitioning symmetrical
vgcreate mirror1 /dev/sdb6 /dev/sdc6 /dev/sdb5 /dev/sdc5

# dm-mirror must be loaded
modprobe dm-mirror

# The third PV MUST be the log PV (which is /dev/sdb5)
lvcreate -m1 --mirrorlog disk -L200G -n home /dev/mirror1 /dev/sdb6 /dev/sdc6 /dev/sdb5

To be clear, I've never actually created it as above, I normally do it as a two step process via some of the above followed by use of vgextend and then finally:
lvconvert -i5 -m1 --mirrorlog disk /dev/mirror1/home /dev/mirror1 /dev/sdb6 /dev/sdc6 /dev/sdb5

You can then monitor progress of the mirror build via the following command if you do it with lvcreate. Or if you used lvconvert with the -i5, it will update you the status every 5-seconds.
lvs -a -o +devices

Revision history for this message
e (0x0065) wrote :

Greg

For the record, I believe this is not a user failure but a bug. My lvm2 mirrored volume works just fine in Gentoo for years.
It is, of course, using three PVs on three separate disks. 2 large ones of equal size and one small one... as per the man...

...doesn't work on Ubuntu. If you read the duplicate the problem seems to originate with debian building binary packages without functionality I happen to want. I am, of course, one of those gentoo using control freaks who expects build options that debian doesn't provide... ...so again, works for me, but not on Ubuntu.

Still broken on Koala thingy BTW...

As a side note, it is possible to build a mirrored LV with only two PVs, but it will 'drastically effect system performance' every reboot while it rebuilds...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.