I'm trying to set LVM mirroring with only 2 devices. It works perfecly when I add third device for mirrorlog, or use corelog. But with only 2 devices and --alloc anywhere LVM nearly always creates both mirrors on one device.
Situation:
- 2 x 50GB devices /dev/xvdf and /dev/xvdg
- I need 1 x 40GB partition on /dev/xvdf that will be mirrored on /dev/xvdg
- I do not want 2 separate drives for mirrored logs, I want mirrored logs on /dev/xvdf and /dev/xvdg (On some extents)
Problem:
LVM nearly always (If I understand lvs command output correctly) creates both mirrors on /dev/xvdf, and mirrorlog on /dev/xvdg (yeah :-(
Commands that I use:
Scenario 1 - simplest:
$ lvcreate -m 1 --mirrorlog mirrored -L40G -n test forfiter --alloc anywhere
$ lvs -a -o +devices
LV VG Attr LSize Origin Snap% Move Log Copy% Convert Devices
test forfiter mwa-a- 40,00g test_mlog 7,09 test_mimage_0(0),test_mimage_1(0)
[test_mimage_0] forfiter Iwi-ao 40,00g /dev/xvdf(0)
[test_mimage_1] forfiter Iwi-ao 40,00g /dev/xvdf(10240)
[test_mimage_1] forfiter Iwi-ao 40,00g /dev/xvdg(2)
[test_mlog] forfiter mwa-ao 4,00m 100,00 test_mlog_mimage_0(0),test_mlog_mimage_1(0)
[test_mlog_mimage_0] forfiter iwi-ao 4,00m /dev/xvdg(0)
[test_mlog_mimage_1] forfiter iwi-ao 4,00m /dev/xvdg(1)
As you can see test_mimage_1 is partially on /dev/xvdf and partially on /dev/xvdf There is 12799 PE allocated on xvdf and 7683 allocated on xvdg.
Funniest thing is that LVM created mlog on one device too...
Scenario 2 - I tried to specify number of extents to use:
$ lvcreate -m 1 --mirrorlog mirrored -L 40G -n test forfiter /dev/xvdf:6-12700 /dev/xvdg:6-12700 /dev/xvdf:0-4 /dev/xvdg:0-4 --alloc anywhere
$ lvs -a -o +devices
LV VG Attr LSize Origin Snap% Move Log Copy% Convert Devices
test forfiter mwa-a- 40,00g test_mlog 2,79 test_mimage_0(0),test_mimage_1(0)
[test_mimage_0] forfiter Iwi-ao 40,00g /dev/xvdf(6)
[test_mimage_1] forfiter Iwi-ao 40,00g /dev/xvdf(10246)
[test_mimage_1] forfiter Iwi-ao 40,00g /dev/xvdf(0)
[test_mimage_1] forfiter Iwi-ao 40,00g /dev/xvdg(7)
[test_mlog] forfiter mwa-ao 4,00m 100,00 test_mlog_mimage_0(0),test_mlog_mimage_1(0)
[test_mlog_mimage_0] forfiter iwi-ao 4,00m /dev/xvdg(6)
[test_mlog_mimage_1] forfiter iwi-ao 4,00m /dev/xvdg(0)
No success :-)
I read many tutorials - everywhere authors suggest to use --alloc anywhere, but for me it looks like results are quite strange (Mirroring works, but not as I expected)
I would like to migrate raid1 from MDADM to LVM.