Operating System - Linux
1822550 Members
3103 Online
109642 Solutions
New Discussion юеВ

Volume Group Export - Import

 
Anubhav Dhingra
Frequent Advisor

Volume Group Export - Import

I have to export the Volume group from one Linux Machine (rx7640 - Connected to EVA4100) to Linux Machine (rx8640 - Same EVA), however, i want VG to there on both servers. I am familier with HP-UX where in we can use
vgexport -p -s -m vg_name. But i believe there are no -p, -s , -m options in Linux.
Thanx for the help in advance....
4 REPLIES 4
skt_skt
Honored Contributor

Re: Volume Group Export - Import


First of all it is not a good idea to keep the same VG on two servers without a cluster software. So you take that risk and make sure that disks are not active at two places at the same time.

you can import with the disk list (/dev/sdx) ; similar to mentioned below.

vgimport -v /dev/vghw_rds3_p1 /dev/sdn /dev/sdo

Emil Velez
Honored Contributor

Re: Volume Group Export - Import



You could use Polyserve for Intel Linux to provide a cluster file system. The cluster file system provides consistent locks between systems. It has its own volume manager to create dynamic volumes but its prupose is the cluster file system.
Anubhav Dhingra
Frequent Advisor

Re: Volume Group Export - Import

Hi Santhosh,

Yeah, i would not activate the VG on both Disks. Its just that, if at all there is some problem, i can immediately revert the changes by connecting rx7640 server back to storage. However, could you please explain more on vgexport/vgimport in Linux....
Matti_Kurkela
Honored Contributor

Re: Volume Group Export - Import

You did not identify your Linux distribution.
However, I assume you're using a distribution with a 2.6.* series kernel, and therefore using Linux LVM2. The old LVM1 used with the 2.4.* kernel series had slightly different behaviour.

This is one of the places where Linux LVM is very different from HP-UX LVM, so put aside your HP-UX knowledge and prepare to learn something new.

There is no need to export the volume group at the old machine: just deactivate it using "vgchange -a n" to make sure the system won't access it. Deactivating the VG will automatically remove the LV device files and the /dev/ directory: don't be afraid, they will automatically come back when you activate the VG.

NOTE: most Linux distributions auto-activate all VG's they can see on boot by default, so you might want to take steps to disable the auto-activation for this VG or explicitly deactivate the VG again as part of the boot process. How to do this depends on which Linux distribution you're using.

The important thing is that the old system must not be allowed to fsck or mount the LVs while they are being used by the new machine, and vice versa. Deactivating the VG is one way to achieve this.

Exporting the VG on Linux marks the VG data structure on the disks as being in "exported" state. When the disk is re-imported on the new machine, the old machine will too see the disk in "imported" state.

In HP-UX, the exported VG loses its name and it can be re-imported using a different name. In Linux, the VG name stays with the VG in the export/import process: it must be explicitly changed using the vgrename command if necessary.

Exporting the VG in Linux is only necessary if you're unsure if there will be another VG with the same name in the new machine. If there are two conflicting VGs with the same name, the non-exported VG is automatically preferred over the exported one.

Then the sysadmin can use "vgs -o +vg_uuid"or "pvs -o +vg_uuid" to see the UUID of the exported VG, and then use the vgrename command to resolve the name conflict, using the UUID to identify the VG to rename.

But back to your problem...

When new disks become visible to the new machine, it should automatically run vgscan (by hotplug/udev). If this does not happen for some reason, you can run "vgscan" manually. You may remember that in HP-UX, vgscan used to be a dangerous command to be used only when there are problems; in Linux it is not dangerous at all.

The LVM devices will be automatically created _when the VG is activated_. This is again different from HP-UX: with it, the devices are created at the time of VG import or LV creation, and will stay until destroyed or exported.

MK
MK