I've a logical volume that is striped across three physical volumes. I had to move this logical volume to another physical volume. This worked nicely with pvmove command. However, I discovered later that the logical volume is still striped and now all three stripes are on the same physical volume. Is there any way to convert striped logical volumes to linear logical volumes? I'm using LVM2 on linux.
I figured that the obvious possibility is to rename the striped logical volume, create a new linear logical volume, and then copy data over, but that requires taking the filesystem system offline for some time. Unfortunately, I can't do that before the next week. Is there any better alternative?
It is also possible to build a mirror first using another single PV, and split of the striped volume afterwards. This requires a free PV but then again I assume pvmove needs this as well.
If you have a volume
lvsplit
using PV'ssda1
andsdb1
for example, andsdc1
is a (temporary) PV with enough free extents, you can do this:This will create a mirror from your striped volume, using sdc1 to build the mirror
...let the mirror build...
This will convert the mirror back to a single volume taking out the extents on PV
/dev/sda1
and/dev/sdb1
, leaving sdc1 as the only PV for your now lineair LV.You can then
pvmove
from sdc1 to another PV, or use the mirror technique instead of pvmove to migrate back tosda1
orsdb1
.Yeah, it's such a PITA. Kills performance dramatically (have had known this once upon a time).
Sure, but quite unpleasant. You'd have to
pvmove
all the extents so that they would be in logical order. I'd prefer scripting it by my own, but you can try using http://bisqwit.iki.fi/source/lvm2defrag.html (at your own risk, of course).