I am trying to migrate my data on lvm to two new disks, and setup mirroring between the two. I have successfully migrated all of the data to the first of the two disks, leaving the second one completely available as a mirror. I verified this using pvdisplay -m /dev/sd{g,h}1
--- Physical volume ---
PV Name /dev/sdg1
VG Name vg
PV Size 931.51 GiB / not usable 3.19 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 238466
Free PE 82866
Allocated PE 155600
PV UUID v2nc3j-EFBR-QpuG-xgro-Rm59-fmu6-IB3QcR
--- Physical Segments ---
Physical extent 0 to 49999:
Logical volume /dev/vg/videos
Logical extents 0 to 49999
Physical extent 50000 to 99999:
Logical volume /dev/vg/home
Logical extents 0 to 49999
Physical extent 100000 to 129999:
Logical volume /dev/vg/music
Logical extents 0 to 29999
Physical extent 130000 to 155599:
Logical volume /dev/vg/videos
Logical extents 50000 to 75599
Physical extent 155600 to 238465:
FREE
--- Physical volume ---
PV Name /dev/sdh1
VG Name vg
PV Size 931.51 GiB / not usable 3.19 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 238466
Free PE 238466
Allocated PE 0
PV UUID LuTrem-WcsZ-qw7l-2CDS-lLKI-wdq0-QEXhLf
--- Physical Segments ---
Physical extent 0 to 238465:
FREE
Then when I try to mirror the home
logical volume for example, it says that I do not have sufficient space. I used lvconvert -m1 vg/home
and the output was:
Insufficient suitable allocatable extents for logical volume : 50000 more required
Unable to allocate extents for mirror(s).
This puzzling to me because it appears as if there is plenty of space on the second disk to mirror. Is there something I have done wrong here? Or is there a way to explicitly tell LVM where to put each leg of the mirror? I'm using lvm2.
You don't have enough space for the mirrorlog. The default is having the mirrorlog on a disk (in a separate PV). See https://bugs.launchpad.net/ubuntu/+source/lvm2/+bug/121527 for more info.
I know this is an old thread, but I'm not sure why the other answer links to a bug report. Unfortunately LVM does a really bad job of explaining why it's saying it's out of space, but you can prevent this altogether with adding "--mirrorlog core" to the end of your lvconvert line. This will keep the log in memory instead of writing it to disk.
Big Disclaimer though: This should only be used for a transient (ie disk migration) event, because with the mirrorlog in memory, it will lose the mirror after a reboot. I use this because we have to migrate our SAN devices from one frame to another when they go out of warranty, and I break off the old mirror after the sync is complete. If you want a permanent solution for mirroring, I'd recommend using mdadm, or setting up another volume (I believe it has to be in it's own VG, but I could be wrong) for the mirrorlog. Or you could use hardware RAID if your infrastructure supports it.