Hi, These series of patches implement 'cling' allocation policy. Patches are applicable to LVM2 2.02.10. In current implementation, 'normal' policy allows the allocation like this (output of lvs -a -o+devices): LV Devices lv0 lv0_mimage_0(0),lv0_mimage_1(0) [lv0_mimage_0] /dev/sdb(0) [lv0_mimage_0] /dev/sda(2) [lv0_mimage_1] /dev/sda(0) [lv0_mimage_1] /dev/sdb(2) [lv0_mlog] /dev/sdc(0) dummy1 /dev/sda(1) dummy2 /dev/sdb(1) dummy3 /dev/sdc(1) You see /dev/sda is used for both lv0_mimage_0 and lv0_mimage_1. If this disk breaks, you lose the whole LV. In this case, what I think is better is something like this: LV Devices lv0 lv0_mimage_0(0),lv0_mimage_1(0) [lv0_mimage_0] /dev/sdb(0) [lv0_mimage_0] /dev/sdb(2) [lv0_mimage_1] /dev/sda(0) [lv0_mimage_1] /dev/sda(2) [lv0_mlog] /dev/sdc(0) dummy1 /dev/sda(1) dummy2 /dev/sdb(1) dummy3 /dev/sdc(1) With these patches, 'normal' allocation tries to do the latter first. Attached is a VG metadata as a testcase. Thanks, -- Jun'ichi Nomura, NEC Corporation of America
# Generated by LVM2: Sat Oct 7 01:56:23 2006
contents = "Text Format Volume Group"
version = 1
description = "Created *before* executing 'lvextend -l+1 testvg0/lv0'"
creation_host = "tetsuo.lab" # Linux tetsuo.lab 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686
creation_time = 1160200583 # Sat Oct 7 01:56:23 2006
testvg0 {
id = "1q8uy1-HgpO-JpQK-Dvn4-SYlQ-r452-YQa0P0"
seqno = 7
status = ["RESIZEABLE", "READ", "WRITE"]
extent_size = 8192 # 4 Megabytes
max_lv = 0
max_pv = 0
physical_volumes {
pv0 {
id = "EkAheU-E42S-nhmb-h3LB-CGEG-4NvX-f0PbFP"
device = "/dev/dm-0" # Hint only
status = ["ALLOCATABLE"]
pe_start = 384
pe_count = 4 # 16 Megabytes
}
pv1 {
id = "Ee7qjC-qtNm-TBd4-ql19-aRZg-mCXk-CCs5Uk"
device = "/dev/dm-1" # Hint only
status = ["ALLOCATABLE"]
pe_start = 384
pe_count = 4 # 16 Megabytes
}
pv2 {
id = "3wvgkO-7p1Z-yoHy-stW4-ZY3p-VHg1-DQe9d7"
device = "/dev/dm-2" # Hint only
status = ["ALLOCATABLE"]
pe_start = 384
pe_count = 4 # 16 Megabytes
}
}
logical_volumes {
lv0 {
id = "RIWMkB-slcN-4ZtA-iVrd-HIZO-PEO2-Z3ommp"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1
segment1 {
start_extent = 0
extent_count = 1 # 4 Megabytes
type = "mirror"
mirror_count = 2
mirror_log = "lv0_mlog"
region_size = 1024
mirrors = [
"lv0_mimage_0", 0,
"lv0_mimage_1", 0
]
}
}
dummy1 {
id = "TlfCSG-kzkN-fv65-xd5g-Hpb0-I3dG-k7UVAJ"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1
segment1 {
start_extent = 0
extent_count = 1 # 4 Megabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 1
]
}
}
dummy2 {
id = "hWyYcp-FD0J-JiFy-dziI-g0FZ-Begs-aYEbJ2"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1
segment1 {
start_extent = 0
extent_count = 1 # 4 Megabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv1", 1
]
}
}
dummy3 {
id = "NhIJ26-07w0-OA6d-ZE14-gegx-nVW8-YRM5vq"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1
segment1 {
start_extent = 0
extent_count = 1 # 4 Megabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv2", 1
]
}
}
lv0_mlog {
id = "OP7pVI-Col0-vKbT-Zwar-M7CC-dZiP-WkV740"
status = ["READ", "WRITE"]
segment_count = 1
segment1 {
start_extent = 0
extent_count = 1 # 4 Megabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv2", 0
]
}
}
lv0_mimage_0 {
id = "2TWuNa-37S2-1m4O-SC02-uDEq-5l1O-AT3CcI"
status = ["READ", "WRITE"]
segment_count = 1
segment1 {
start_extent = 0
extent_count = 1 # 4 Megabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv1", 0
]
}
}
lv0_mimage_1 {
id = "S2EKHn-CroW-aFS7-ptF5-mYUo-DuYt-NmT1YD"
status = ["READ", "WRITE"]
segment_count = 1
segment1 {
start_extent = 0
extent_count = 1 # 4 Megabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 0
]
}
}
}
}