cancel
Showing results for 
Search instead for 
Did you mean: 

LVM

irshad_1
Occasional Advisor

LVM

please explain scenario use LVM vgexport and vgimport to safely mount a SAN volume from a RHEL 5 host (HOSTA) to another RHEL 5 host (HOSTB) in case if HOSTA crashes .

1 REPLY
Matti_Kurkela
Honored Contributor

Re: LVM

In Linux LVM2 (which is the standard version in all modern Linuxes with kernel version 2.6+, including RHEL 5), vgexport and vgimport can only be used to avoid VG name conflicts when moving volumes from one host to another.

If you know that the VG names won't conflict, you can move the volumes without vgexport/vgimport: just move the disks to the other host. The udev subsystem will automatically run vgscan as it detects new disks, and vgscan will automatically recognize the added VG.

 

The Linux vgexport/vgimport commands are not useful in protecting a SAN volume that has been presented to two or more hosts simultaneously. When you run vgexport, the VG is marked as exported on the disk. So all the hosts accessing the disk will see it as "exported" on next vgscan. You cannot have the VG exported on one host, and imported on another if both hosts can see the volume(s): when you import the VG on HOSTA, the HOSTB will also see the VG as imported as soon as it runs a vgscan (e.g. when someone plugs in a USB stick to transfer some files).

 

(If you're familiar with HP-UX LVM, be aware that this is one of the points where Linux LVM is very different from HP-UX LVM.)

 

The old Linux LVM1 that was used with 2.4 and older kernels might have been different, but it's obsolete now.

 

If you want to automatically mount the SAN volume to HOSTB if HOSTA crashes, you need a failover cluster suite, e.g. RedHat Cluster. One of its features is a system that can prevent HOSTA from mounting the shared volumes if HOSTB has them mounted, or vice versa.If your RHEL 5 is updated to level 5.6 or better, this is provided by the clvmd daemons running on each cluster node and the "vgchange -ey <vgname>" command. In RHEL 5.5 and older, VG tags can be used for the same purpose.

 

Please see this RedHat Knowledge Base article:

https://access.redhat.com/kb/docs/DOC-3068

(RedHat Customer Portal access required)

MK