Convert LV to striped

From JoBaPedia
Jump to navigation Jump to search

To convert an lv from the usual linear to striped mode directly is not possible. It needs two steps: create a striped (old style) mirror lv and then remove the original pv from the mirror.

Given you have a vg vgdata with pv sdb and lv lvdata

First extend the vg with a new pv for each stripe, e.g. sdc and sdd for 2 stripes (pvcreate them first)

vgextend vgdata /dev/sdc /dev/sdd

If you want to reuse sdb as a stripe pv you'd have to move the data to one of the new pv's now

pvmove -n /dev/vgdata/lvdata /dev/sdb /dev/sdd

Next mirror the lv to the striped pv's

lvconvert --type mirror --corelog --mirrors 1 --stripes 2 /dev/vgdata/lvdata

Finally remove the linear part (sdb, or sdd if you pvmoved above) from the mirror lv

lvconvert --mirrors 0 /dev/vgdata/lvdata /dev/sdb

Check the result with

lvdisplay --maps --all /dev/vgdata/lvdata