So, what I can see is everything is on /dev/md125p2
and we want to reduce the size of this PV.
Your output from pvs -v --segments /dev/md125p
show you have a very large free space (SSize==81947
) after your lv_mysql
and before your lv_root
. This is big enough to house lv_root
and all of the LVs that come after it in the physical layout.
So, the first set of numbers I'd suggest is:
***# pvmove --alloc anywhere /dev/md125p2:480745-488244 /dev/md125p2:384000+7499
that is, move the whole of lv_home
to the free space starting directly after lv_mysql
.
Then re-run pvs -v --segments /dev/md125p
to see the revised numbers, and move the next block into whatever free space is left.
This will effectively defrag your PV.
Now, pvmove
may have way more options than what I'm using (maybe specifying the PV instead of the extents?) but what I got comfortable with is just being explicit with the blocks, so all of my sources and targets are in the form of /dev/<dev>:<Start>-<End>
or /dev/<dev>:<Start>+<SSize-1>
.
I suspect your problem was mainly missing the extents off of your "source" specification.
I've seen a few examples out their using -end
- I don't know if that's something that's supposed to work, but it would beg the question "end of what?". So I avoid it and use explicit block numbers. You just need to be mindful that the +
syntax is a plus, and needs to be one less than the SSize.
Extra
OK, on the source side it seems like you can do -name lv_home /dev/md125p2
as a short-hand for /dev/md125p2:480745-488244
- but note also that this will get more complex if lh_home
was fragmented into multiple extents (would it mean "all fragments?") - I think I still prefer the numbers approach. Note that your example in the question didn't include the LV name, so I'm not sure what pvmove
would have understood from what you gave it...