[linux-lvm] vgimport/vgexport commands when logically moving disks between systems
pcaulfie at redhat.com
Tue Dec 5 10:28:43 UTC 2006
> I believe I might be misunderstanding whether vgimport and vgexport are needed in my
> particular situation. It would be great to get some feedback for clarification.
> THE SETUP:
> LVM1 (1.0.8-14) on two RedHat AS3 systems (kernel: 2.4.21-47.ELsmp).
> I think the same concept applies for LVM2 as well though.
> Machine A is primary and Machine B is backup in a two-node Linux heartbeat cluster.
> Both machines are connected to the same SAN via fiber, and see the same disks, where
> the volume groups reside.
> THE STRATEGY:
> The idea is for A to have the LVM file systems mounted, and when a failure is
> detected, have the LVM file systems "moved" to (or seen by) system B. The way this
> is currently accomplished is for A to do the following upon detection of a failure:
> + unmount file systems
> + deactivate (vgchange -an $vg)
> + export (vgexport $vg)
> then, on system B:
> + import & activate (vgimport $vg $disks)
> + mount file systems
> THE ISSUE:
> The export works as expected on A, but upon import on B, a return code of 4 is
> returned meaning "volume group already exists". The mounting works properly, but
> all the disks are shown like this:
> "inactive PV /dev/sdx is in EXPORTED VG $vg"
> when inspected with pvscan.
> Does a vgimport and/or vgexport mark the disks themselves, or simply update the
> system on which the commands are run??? I suppose that is essentially the heart of
> this issue.
Yes, vgimport/export marks the disks in the volume group. It's really for moving disks between systems where the target system might
have a volume group with the same name as the one to be imported.
> I'm starting to believe that for our strategy the vgexport and vgimport commands are
> not necessary, and are actually causing the problem. (The HOWTO mentions these
> commands are used to move disks between systems, but perhaps that is meant to refer
> to disks that are only physically moved?)
> Instead, the following strategy might be correct in case system A fails (Note: no
> vgimport or vgexport commands):
> + unmount fs
> + vgchange -an $vg
> then, on system B:
> + vgchange -ay $vg
> + mount fs
> IS THIS CORRECT???
Yes. IF YOU'RE VERY CAREFUL!
vgimport/vgexport are not the tools you want for this job.
More information about the linux-lvm