3

I've got an existing VG containing a single LV on a RHEL server that consists of a handful of SAN disks. In an effort to migrate the server to a newer SAN, I'd like to mirror the existing storage to newer storage that's been added to the server.

We're attempting to do this in-place so that there's no disruption to the availability of the LV. I suspect that there should be some way to do this using the lvconvert command, but I can't seem to figure it out for the life of me. It seems simple enough to add a mirror to the volume, but I have been unable to find anything on how to specify what set of disks get used to create the new mirror leg being added on.

Currently I've got the following:

Old SAN:

PV                  VG      Fmt  Attr PSize     PFree
/dev/mapper/mpath0  vg_ap01 lvm2 a--  136.00G      0
/dev/mapper/mpath1  vg_ap01 lvm2 a--  136.00G      0
/dev/mapper/mpath11 vg_ap01 lvm2 a--  136.00G   1.00G
/dev/mapper/mpath12 vg_ap01 lvm2 a--  136.00G      0
/dev/mapper/mpath2  vg_ap01 lvm2 a--  136.00G      0
/dev/mapper/mpath3  vg_ap01 lvm2 a--  136.00G   1.00G
/dev/mapper/mpath4  vg_ap01 lvm2 a--  136.00G   1.00G
/dev/mapper/mpath5  vg_ap01 lvm2 a--  136.00G   1.00G
/dev/mapper/mpath6  vg_ap01 lvm2 a--  136.00G      0

New SAN:

PV                  VG      Fmt  Attr PSize     PFree
/dev/mapper/mpath19 vg_ap01 lvm2 a--  136.00G 136.00G
/dev/mapper/mpath20 vg_ap01 lvm2 a--  136.00G 136.00G
/dev/mapper/mpath21 vg_ap01 lvm2 a--  136.00G 136.00G
/dev/mapper/mpath22 vg_ap01 lvm2 a--  136.00G 136.00G
/dev/mapper/mpath23 vg_ap01 lvm2 a--  136.00G 136.00G
/dev/mapper/mpath24 vg_ap01 lvm2 a--  136.00G 136.00G
/dev/mapper/mpath25 vg_ap01 lvm2 a--  136.00G 136.00G
/dev/mapper/mpath26 vg_ap01 lvm2 a--  136.00G 136.00G
/dev/mapper/mpath27 vg_ap01 lvm2 a--  136.00G 136.00G

The goal is to mirror mpath0-6,11-12, which combined create the LV /dev/vg_ap01/lv_ap01, over to mpath19-27. Later, once the mirroring has completed, we'd like to break the mirror and pull the older disks (0-6,11-12) out of the VG.

The caveat is that there can be no crossover on the mirroring, all of the data must be contained separately on both groups of disks or else we won't be able to get rid of the old SAN storage.

Anyone ever encountered this before? Thank you in advance.

1
  • 3
    Why bother with mirroring? Just pvmove everything. Oct 17, 2014 at 0:48

1 Answer 1

1

solution 1 :

as per comment, use pvmove (you might be at risk during migration).

solution 2 :

lvextend -m 1 /dev/vg_ap01/lv_ap01 /dev/mapper/mpath19 /dev/mapper/mpath20 ...

then

lvreduce -m 0 /dev/vg_ap01/lv_ap01 /dev/mapper/mpath1 /dev/mapper/mpath2 ...

where

  • -m specify number of mirror
  • /dev/vg_ap01/lv_ap01 is the logical volume
  • disks are to be added/removed
1
  • overall your solution 2 looks good, but I was looking for the -m option in lvextend and didn't find it. From what I could find, I think you now use lvconvert instead of lvextend and lvreduce, which probably changed since this answer in 2014. see linux.die.net/man/8/lvconvert Feb 7, 2022 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.