Operating System - HP-UX
1834051 Members
2725 Online
110063 Solutions
New Discussion

Importing volume from one host to another

 
SOLVED
Go to solution
Bob Manocchia
Regular Advisor

Importing volume from one host to another

I am trying to import a volume group from one server to another. I've created the /dev/vg and also the group file using mknod. I've created the map file on the first host using this command: vgexport -p -v -m /tmp/vgsap01.map /dev/vgsap01. I get the following error: volume contains no LVM information. Do I need to use pvcreate on all these disks and if so what do I do after that.
23 REPLIES 23
Anil C. Sedha
Trusted Contributor

Re: Importing volume from one host to another

Bob,

First, on your other server run the mknod comamnd for configuring the disks.

Then run pvcreate command

Then you can import the volume group contents using the vgimport command (FROM man on vgimport) -

Import the volume group /dev/vg01 that is located in the map file

vgimport -v -m /tmp/vgsap01.map /dev/vgsap01 /dev/dsk/c0t5d0 /dev/dsk/c0t7d0

Activate the volume group following a successful import:

vgchange -a y vgsap01

Hope this helps. Post the errors if you still get any.
If you need to learn, now is the best opportunity
Rick Garland
Honored Contributor

Re: Importing volume from one host to another

If you are just starting on creating the VG, why export it? Just start the creation on the disk in the other host.

Yes, you do need to pvcreate a disk to place it under LVM control.

You have created the /dev/vg, mknod the group file in the directory. Do a vgcreate to actually create the VG. After that you can add logical volumes.

At this point you should have no trouble doing the vgexport command you have specified above.

Bob Manocchia
Regular Advisor

Re: Importing volume from one host to another

I ran pvcreate on all 16 disks then ran vgimport -m /tmp/vgsap01.map /dev/vgsap01 \
/dev/dsk/c9t0d0 /dev/dsk/c9t0d1 etc....
I received the following error:

The physical device /dev/dsk/c9t0d0 is not part of a volume group
for all 16 devices.
Rick Garland
Honored Contributor

Re: Importing volume from one host to another

Did you create any volume groups? (vgcreate)
Jeff Schussele
Honored Contributor

Re: Importing volume from one host to another

Hi Bob,

I'm assuming this is an *existing* VG on host1 that you want visible on host2. If this is the case then you should use the -s parm of vgexport/vgimport - as follows:

vgexport -m /tmp/vgsap01.smap -s -p -v /dev/vgsap01

Then ftp the map file over to host2 & run

vgimport -m /tmp/vgsap01.smap -s -v /dev/vgsap01

The -s causes LVM so search for the unique VGID on the disks so you don't have to specify the devices.

And NO - if the VG is in use already on host1 then running pvcreate on either host1 or host2 will destroy the data.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Anil C. Sedha
Trusted Contributor

Re: Importing volume from one host to another

run a vgcreate before you run the vgimport command

vgcreate /dev/vgsap01 /dev/dsk/c9t0d0 /dev/dsk/c9t0d1 and so on

then run the vgchange -a y /dev/vgsap01

Then run vgimport.. hopefully it should work this time.
If you need to learn, now is the best opportunity
Bob Manocchia
Regular Advisor

Re: Importing volume from one host to another

I created the volume group then ran vgchange -a y /dev/vgsap01 then ran vgimport -m /tmp/vgsap01.map /dev/vgsap01 and received the following error:

volume group "/dev/vgsap01" already exists in the "/etc/lvmtab" file.
Jeff Schussele
Honored Contributor

Re: Importing volume from one host to another

Hi Bob,

Don't run vgcreate ahead of the vgimport.
Just create the /dev/vg_name dir & group file.
The vgimport command will add it to the lvmtab.
You'll have to vgexport the VG on host2 & then recreate the dir & group file.
THEN run the vgimport.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Mridul Shrivastava
Honored Contributor

Re: Importing volume from one host to another

Bob
I understand the Vg u r talking abt is on the shared storage so both host will have different device file names for the same disk. while exporting the vg from host1 u have to use the following command:
# vgexport -v -s -m /tmp/vgsap.map /dev/vgname

this will create the map file and also the VGID for this vg.
>>copy this map file to host2 in /tmp

On host2 u have to create only group file and directory for the vg then execute the following command:
#vgimport -v -s -m /tmp/vgsap.map

this will update the lvmtab, this command will scan all the disks on the storage for the VGID and will update the lvmtab file accordingly.
Time has a wonderful way of weeding out the trivial
Siju Vadakkan
Trusted Contributor

Re: Importing volume from one host to another

On the host where Vg is actvated:
1. vgexport -p -v -s -m /tmp/vgsap01.map vgsap01
2. ftp the map file to the second node.

On the host where u need to import:

1. mkdir /dev/vgsap01
2. mknod /dev/vgsap01/group c 64
3.vgimport -s -m /tmp/vgsap01.map vgsap01.

You don't need to pvcreate since while importing it will check for the disks which is having VGID. (-s option records the VGID and -m option records the names of logical volume device files)

Bob Manocchia
Regular Advisor

Re: Importing volume from one host to another

What I'm trying to do is to restore hosta's configuration onto hostb. I start with an ignite tape created with the entire vg00 volume group and ignite hostb. I then want to configure disks attached to hostb with the volume group config for the disks attached to hosta using vgimport. NOTE: The disks on hosta and hostb are completely different not the same with different device id on each server.

Hope this clears things up a bit.
Bob Manocchia
Regular Advisor

Re: Importing volume from one host to another

Siju:

I ran vgexport -p -v -s -m /tmp/vgsap01.map vgsap01 on the host where the VG is activated. I then ftp'd the mape file to the second node. One the second node I did mkdir /dev/vgsap01 and mknod /dev/vgsap01/group c 64 . The I ran vgimport -s -m /tmp/vgsap01.map vgsap01 and received the following error:

Couldn't access the list of physical volumes for volume group "/dev/vgsap01".
David Bellamy
Respected Contributor

Re: Importing volume from one host to another

Bob:
on hostb do a vgimport naming the disk that you want to belong to the volume group
ex: vgimport -v /dev/vgsap01 /dev/dsk/c1t2d0 dev/dsk/c1t2d1 and so on
Bob Manocchia
Regular Advisor

Re: Importing volume from one host to another

David: I did name them individually and received the same error.
David Bellamy
Respected Contributor

Re: Importing volume from one host to another

Bob did you try it this way
vgimport -v -m /etc/lvmconf/vgsap01.map /dev/vgsap01 /dev/dsk/c1t2d0 /dev/dsk/c1t2d1
if i correct all you are looking for is the lvol structure.
melvyn burnard
Honored Contributor

Re: Importing volume from one host to another

well to me it looks like you do not have the discs from the first node visible on the second node.
Have you verified this?
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Bob Manocchia
Regular Advisor

Re: Importing volume from one host to another

David:

I ran vgimport -v -m /tmp/vgsap01.map /dev/vgsap01 and received the following error:

The physical volumes specified on the command line do not belong to the sam volume group
Bob Manocchia
Regular Advisor

Re: Importing volume from one host to another

Melwyn:

The hosts are connected to an entirely different set of disks.
David Bellamy
Respected Contributor

Re: Importing volume from one host to another

Bob
do a pvcreate on the disk and then run the vgimport command
David Bellamy
Respected Contributor

Re: Importing volume from one host to another

i meant a pvcreate and a vgextend
Bob Manocchia
Regular Advisor

Re: Importing volume from one host to another

David:
I just did that then ran the vgimport command again naming all the physical volumes and received the following error:

Volume group "/dev/vgsap01" already exists in the "/etc/lvmtab" file.
Tiziano Contorno _
Valued Contributor
Solution

Re: Importing volume from one host to another

You wrote:
"What I'm trying to do is to restore hosta's configuration onto hostb. I start with an ignite tape created with the entire vg00 volume group and ignite hostb. I then want to configure disks attached to hostb with the volume group config for the disks attached to hosta using vgimport. NOTE: The disks on hosta and hostb are completely different not the same with different device id on each server.

Hope this clears things up a bit."

Yes, this clears things up.

2 options:

1) Do a make_tape_recovery with -x inc_entire=vgsap01 and restore choosing advance options, in this way you can define your new vgsap01 on these new disks.

2) Manually create vgsap01 and its lvols and do a restore from tape (or remote copy or whatever).

vgimport / vgexport are supposed to work on the SAME disks. They work with vgid written on disk.

From man:
"vgimport assumes that the volume group information has already been created on the physical volumes"

Regards!
Bob Manocchia
Regular Advisor

Re: Importing volume from one host to another

Vanadio: Thanks. I came to that conslusion. We shose option 2. We've written scripts to rebuild the lvol/filesystem structure automatically on the new disks. Thanks for all your help.