Attempting to add a disk to mirror an LVM volume on CentOS 7 always fails with "Insufficient free space: 1 extents needed, but only 0 available". Having searched for a solution, I have tried specifying disks, multiple logging options, adding 3rd log partition, but have not found a solution
Not sure if I am making a rookie mistake, or there is something more subtle wrong (I am more familiar with ZFS, new to using LVM):
# lvconvert -m1 centos_bi/home
Insufficient free space: 1 extents needed, but only 0 available
# lvconvert -m1 --corelog centos_bi/home
Insufficient free space: 1 extents needed, but only 0 available
# lvconvert -m1 --corelog --alloc anywhere centos_bi/home
Insufficient free space: 1 extents needed, but only 0 available
# lvconvert -m1 --mirrorlog mirrored --alloc anywhere centos_bi/home /dev/sda2
Insufficient free space: 1 extents needed, but only 0 available
# lvconvert -m1 --corelog --alloc anywhere centos_bi/home /dev/sdi2 /dev/sda2
Insufficient free space: 1 extents needed, but only 0 available
The two disks are of the same size, and have identical partition layouts via "sfdisk -d /dev/sdi > part_table; sfdisk /dev/sda < part_table". The current configuration is detailed below.
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda1 centos_bi lvm2 a-- 496.00m 496.00m
/dev/sda2 centos_bi lvm2 a-- 465.27g 465.27g
/dev/sdi2 centos_bi lvm2 a-- 465.27g 0
# vgs
VG #PV #LV #SN Attr VSize VFree
centos_bi 3 3 0 wz--n- 931.02g 465.75g
# lvs -a -o +devices
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert Devices
home centos_bi -wi-ao---- 391.64g /dev/sdi2(6050)
root centos_bi -wi-ao---- 50.00g /dev/sdi2(106309)
swap centos_bi -wi-ao---- 23.63g /dev/sdi2(0)
# pvdisplay
--- Physical volume ---
PV Name /dev/sdi2
VG Name centos_bi
PV Size 465.27 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 119109
Free PE 0
Allocated PE 119109
--- Physical volume ---
PV Name /dev/sda2
VG Name centos_bi
PV Size 465.27 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 119109
Free PE 119109
Allocated PE 0
--- Physical volume ---
PV Name /dev/sda1
VG Name centos_bi
PV Size 500.00 MiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 124
Free PE 124
Allocated PE 0
# vgdisplay
--- Volume group ---
VG Name centos_bi
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 10
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 3
Act PV 3
VG Size 931.02 GiB
PE Size 4.00 MiB
Total PE 238342
Alloc PE / Size 119109 / 465.27 GiB
Free PE / Size 119233 / 465.75 GiB
# lvdisplay
--- Logical volume ---
LV Path /dev/centos_bi/swap
LV Name swap
VG Name centos_bi
LV Write Access read/write
LV Creation host, time localhost, 2014-08-07 16:34:34 -0400
LV Status available
# open 2
LV Size 23.63 GiB
Current LE 6050
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/centos_bi/home
LV Name home
VG Name centos_bi
LV Write Access read/write
LV Creation host, time localhost, 2014-08-07 16:34:35 -0400
LV Status available
# open 1
LV Size 391.64 GiB
Current LE 100259
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Path /dev/centos_bi/root
LV Name root
VG Name centos_bi
LV Write Access read/write
LV Creation host, time localhost, 2014-08-07 16:34:37 -0400
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
Best Answer
Since about September 2013, the default mirror segment type in lvm2 has been 'raid1' (not 'mirror'). This makes
--corelog
and--mirrorlog disk/core/mirrored
options inapplicable in this default case, because raid1 segment type always stores its logs (in fact, metadata subvolumes) on-disk on the same PV(s) as the LV being mirrored. You no-longer need a third PV for the log, or to store the log in-memory.There are two further implications. First, the command to create the mirror is simplified, because there is only a need to specify the LV to be mirrored, and the (usually one) PV on which the mirror segment will be stored:
# lvconvert -m1 /dev/my_vg/my_lv /dev/my_new_pv
Second, there are a couple of space considerations. You need to have:
Often this original-PV additional space requirement causes a problem because there is no space in the existing PV for even 1 new LE to be allocated for the log. In this case, you might get an error of the kind OP encountered, ie.,
1 extents needed, but only 0 available
.The remedy, as indicated above by others, is to resize (shrink, after shrinking the filesystem) the existing LV, so there is room for the log to be allocated on the same PV. If you can't do that, you can use
--type mirror
to force legacy 'mirror' segment type.