Operating System - HP-UX
1825891 Members
3015 Online
109689 Solutions
New Discussion

Re: Add logical volume to VG in cluster

 
SOLVED
Go to solution
Weertman
Frequent Advisor

Add logical volume to VG in cluster

When I add a logical volume to a vg in a package do I need to do the export and import?
It is a raw volume so no mkfs is needed.
23 REPLIES 23
Sharma Sanjeev
Respected Contributor

Re: Add logical volume to VG in cluster

Hi

Yes, u need to export and import it on another node with new map file

Rergards
Sanjeev
Everything is Possible as " IMPOSSIBLE" word itself says I M POSSIBLE
Avinash20
Honored Contributor

Re: Add logical volume to VG in cluster

Yes, it is required.

The device file /dev//* needs to be available on the other node also

Hence you need to do a vgexport -p on one node and on the other node, vgexport, mkdir,mknod, vgimport..

Please assign points
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Weertman
Frequent Advisor

Re: Add logical volume to VG in cluster

when you omit that can that cause volume corruption in case of fail-over?
yulianto piyut
Valued Contributor

Re: Add logical volume to VG in cluster

absolutely, YES! you must vgexport and vgimport to the other node and you must edit your control file (*.cntl) in your cluster configuration and add your new LV, for ex:

LV[0]=/dev/vgbea/lvbea; FS[0]=/apps/bea; FS_MOUNT_OPT[0]="-o rw"; FS_UMOUNT_OPT[
0]=""; FS_FSCK_OPT[0]="";FS_TYPE[0]="vxfs"
Avinash20
Honored Contributor

Re: Add logical volume to VG in cluster

"when you omit that can that cause volume corruption in case of fail-over?"

Yes, that why we are doing vgexport in preview mode on one server and doing a vgimport on the other node

vgimport wont work if the vg is already there in lvmtab, hence we need to export and import it again ..
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Weertman
Frequent Advisor

Re: Add logical volume to VG in cluster

what is the correct import command?
Johnson Punniyalingam
Honored Contributor

Re: Add logical volume to VG in cluster

Example:-

On the other node:
1. Export the VG
>>>vgexport /dev/vgxx

2. Recreate the directory
>>>>mkdir -p /dev/vgxx

3. Recreate the VG group file
>>>mknod /dev/vgxx/group c 64 0xMM0000
where MM is a unique identifier (ex 01 for vg01)

4. Preview the vgimport to check for any possible error
>>>>vgimport -pvs -m /dev/vgxx
where mapfile is the one copied from the first node

5. If no error, remove the preview mode
>>>>vgimport -vs -m /dev/vgxx

6. Activate in share mode
>>>>vgchange -a s /dev/vgxx

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
Weertman
Frequent Advisor

Re: Add logical volume to VG in cluster

vgchange -a s /dev/vg02
vgchange: Volume group "/dev/vg02" does not exist in the "/etc/lvmtab" file.
Johnson Punniyalingam
Honored Contributor

Re: Add logical volume to VG in cluster

>>vgchange -a s /dev/vg02
vgchange: Volume group "/dev/vg02" does not exist in the "/etc/lvmtab" file.<<

what is vgname did you import on the other node..?

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
Weertman
Frequent Advisor

Re: Add logical volume to VG in cluster

Also vg02

Re: Add logical volume to VG in cluster

you only run "vgchange -a s ..." if this is a SHARED logical volume used with SLVM (usually as part of a RAC cluster). If this is just a standard Serviceguard cluster where a logical volume is only ever active on one node in the cluster at any one time, you can omit this step.

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Ganesan R
Honored Contributor

Re: Add logical volume to VG in cluster

Hi,

Follow this steps. Assuming you are creating lv on VG02 and it is currently activated on node1

on node1

Create the logical volume as per LVM commands. After creation,
#vgexport -p -v -m /tmp/vg02.map vg02
It will just create a map file /tmp/vg02.map

Copy this map file to second node.(node2)

on node2. (Assuming VG02 is not activated here)

Note down the minor number of vg02
#vgexport /dev/vg02
#mkdir /dev/vg02
#mknod /dev/vg02/group c 64 0x020000
#vgimport -v -m /tmp/vg02.map vg02

Now the necessary devices files will be created on node2 as well. So when the package moves here all the lv's including new lv get mounted.

Not that these steps doesn't include the modifications of package control file. you need take care of that seperately.
Best wishes,

Ganesh.
Sharma Sanjeev
Respected Contributor

Re: Add logical volume to VG in cluster

Hi

If still u want to see your VG on another node than u can activate it as readonly.

vgchange -a r /dev/vg02

Regards
Sanjeev
Everything is Possible as " IMPOSSIBLE" word itself says I M POSSIBLE
Weertman
Frequent Advisor

Re: Add logical volume to VG in cluster

shouldn't it be:
vgimport -v -m /tmp/vg02.map vg02 /dev/dsk/c16t0d5

There is no hw info in the map file.

that works ok
Sharma Sanjeev
Respected Contributor

Re: Add logical volume to VG in cluster

Hi

Best way is

on 1st node
vgexport -p -m /tmp/mapfile -f /tmp/diskfile /dev/vg00

than copy mapfile and disk file to another node

than on 2nd node
vgexport vg02
mknod ( minor number should be same as 1st node vg02 )
vgimport -m /tmp/mapfile -f /tmp/diskfile /dev/vg02

if u want to activate VG on 2nd node as read only

vgchange -a r /dev/vg02

Regards
Sanjeev
Everything is Possible as " IMPOSSIBLE" word itself says I M POSSIBLE
Weertman
Frequent Advisor

Re: Add logical volume to VG in cluster

What is the destination node has a different device name?
Sharma Sanjeev
Respected Contributor

Re: Add logical volume to VG in cluster

Hi Again

Than u need to import with device name.

But generally The nodes in Cluster having same device name

Regards
Sanjeev
Everything is Possible as " IMPOSSIBLE" word itself says I M POSSIBLE

Re: Add logical volume to VG in cluster

...seems to be a lot of poor advice being handed out on this thread...

first off, when you are running the vgexport on your primary node to generate the map file, you need to make nsure you include the "-s" option on the vgexport. This will ensure that as well as the lvol names, the volume group ID is also writrten to the map file (think of the volume group ID or VGID as like a disk signature)

Then when importing the volume group on the other node use the "-s" option on the vgimport and the vgimport command will scan all the disks visible to the system and look for that VGID - that way it knows what disks need to be part of the volume group and you don't have to list them on the command line.

As for the point about device files being the same on all cluster nodes. In my experience they are different as often as they are the same. Serviceguard really doesn't care if a LUN is seen as c3t5d0 on one node and c7t5d0 on another node - it can cope with that without a problem.

HTH

Duncan

I am an HPE Employee
Accept or Kudo

Re: Add logical volume to VG in cluster

Ganesan's post was closest to correct - I've altered it slightly (I don't know what your VG is called or what VG minor numbers you use so you'll need to adjust those for your own system):

on node1

Create the logical volume as per LVM commands. After creation,
#vgexport -p -s -v -m /tmp/vg02.map vg02
It will just create a map file /tmp/vg02.map

Copy this map file to second node.(node2)

on node2. (Assuming VG02 is not activated here)

Note down the minor number of vg02
#vgexport /dev/vg02
#mkdir /dev/vg02
#mknod /dev/vg02/group c 64 0x020000
#vgimport -v -s -m /tmp/vg02.map vg02


It will take a little longer as it has to scan all the disks on the system, but should work.


HTH

Duncan

I am an HPE Employee
Accept or Kudo
Sharma Sanjeev
Respected Contributor

Re: Add logical volume to VG in cluster

Hi Duncan

You are right at this point, but if are dealing with huge Disks ( Means number of disk is more ) than -s option will take very long time & if some devide is missing than ....

Regards
Sanjeev
Everything is Possible as " IMPOSSIBLE" word itself says I M POSSIBLE
Weertman
Frequent Advisor

Re: Add logical volume to VG in cluster

About the volume corruption.
A logical volume is added on node 1 and not on node 2.
How can the content of a volume get corrupted when the volume group gets activated and is missing a device file pointing to a volume?
Wouldn't you only be missing that volume on node 2?
Weertman
Frequent Advisor

Re: Add logical volume to VG in cluster

Thank you Duncan.
Solution

Re: Add logical volume to VG in cluster

weertman

about volume corruption...

yes you're corerct it wouldn't actually be "corrupted" it just wouldn't work correctly - either the VG wouldn't activate or the new lvol would be missing. But there would be no actual data corruption.

I guess it depends on the interperetation of the word "corruption". You could ceratinly say that the volume group configuration was "corrupted" as it would be missing data, but the actual contents of your logical volumes and filesystems wouldn't get corrupted.

HTH

Duncan

I am an HPE Employee
Accept or Kudo