1825694 Members
3260 Online
109686 Solutions
New Discussion

vgexport -p option

 
Umang Bhavsar
Occasional Advisor

vgexport -p option

Does anybody know the difference of export with -p option and without -p option ?

I have read man page.

I have vgexport volume group vg10 in mapfile vgexport -m /tmp/vg10.map /dev/vg10 using this command. But when i import the on different system ( Source A from 11.0 to 11.11 Source B )it has given me an error

vgimport -m /tmp/vg10.map /dev/vg20
vgimport: Unable to read the physical volume.uxdevtst: /dev/vg20

I was able to use diskinfo and dd.
See the output below.

> diskinfo /dev/rdsk/c12t1d5
SCSI describe of /dev/rdsk/c12t1d5:
vendor: HP
product id: OPEN-E*18
type: direct access
size: 256076640 Kbytes
bytes per sector: 512

dd if=/dev/rdsk/c12t1d5 of=/dev/null bs=1024
37530+0 records in
37530+0 records out

NOW MY QUESTION ARE :

(1) DID MY PROBLEM HAPPEN BECAUSE OF -P OPTION ? IS -P OPTION IS MUST WITH VGEXPORT WHEN YOU ARE TRYING TO IMPORT WITH -M MAP FILE ?

(2) CAN I RESTORE MY VOLUME GROUP FROM MAP FILE SAME WAY ?

Thanks in advance.


Umang
15 REPLIES 15
Sundar_7
Honored Contributor

Re: vgexport -p option

Hi,

The -p option is just the "preview" of the operation. vgexport command with -p option will create the map file but wont remove the VG from the system. So u dont have to deactive the VG from the system.

One thing that is missing in your command is that even with the mapfile u need to mention the PVs. the best option here to use is the -s option.

# vgexport -s -v -m /tmp/mapfile /dev/vg10

for importing

# mkdir /dev/vg20
# mknod /dev/vg20/group c 64 0x200000
# vgimport -s -v -m /tmp/mapfile /dev/vg20

See if this helps

Thanks

Sundar.

Learn What to do ,How to do and more importantly When to do ?
Umang Bhavsar
Occasional Advisor

Re: vgexport -p option

Sundar,

My understanding is -s option is shareable. If the VG is part of MC Service Guard Cluster You don`t need to use -s option.

Umang
Umang
A. Clay Stephenson
Acclaimed Contributor

Re: vgexport -p option

THe use of the -s option is optional but will make things easier for. With -s, a unique VGID is written to the map file. That Volume Group ID can then be used on the vgimport; the system is search for disks which have that ID and they are included automatically. The downside is that on arrays with multiple paths to the same physical devices all the primary paths are used so that striping optimization is lost --- but can be recreated later.

If you don't use -s then you must also specify the disks on the vgimport and that is what is missing in your use of vgimport.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: vgexport -p option

THe use of the -s option is optional but will make things easier for. With -s, a unique VGID is written to the map file. That Volume Group ID can then be used on the vgimport; the system is searched for disks which have that ID and they are included automatically. The downside is that on arrays with multiple paths to the same physical devices all the primary paths are used so that striping optimization is lost --- but can be recreated later.

If you don't use -s then you must also specify the disks on the vgimport and that is what is missing in your use of vgimport.
If it ain't broke, I can fix that.
Sridhar Bhaskarla
Honored Contributor

Re: vgexport -p option

Hi,

As said already, -p is for preview and -s is to generate map files with VGID information so that import will be easier.

In addition, another convenient way of exporting the volume groups is to use -f option. This will create a file with all the disks. During the import, you will just need to change the controller numbers (cx) in the file and import the VG. This will save your previous lvmtab structure.

vgexport -v -p -m /tmp/vgxx.map -f /tmp/vgxx.disks vgxx

This will not actually export but generates the map and disk information files for vgxx. Once you are done with your work, edit vgxx.disks and change the cx values if the instance numbers are changed.

vgimport -v -m /tmp/vgxx.map -f /tmp/vgxx.disks vgxx (after creating group device file).

It is better to preview export and generate various kind of map files like with -s, without -s and -f options etc.,

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Dave La Mar
Honored Contributor

Re: vgexport -p option

Umang -
I would guess that you understand the -p option from the previous posts.

This is what we commonly use:

vgexport ???p -v ???m /tmp/import/vgjdaprod.map_prod vgjdaprod | sed ???1d???>/tmp/import/vgjdaprod.dev_prod

The sed statement parses out the devices for import on another system. Though the C numbers need to be changed, in some cases, for the other machine, the t and d numbers and primaries are inorder of the importance on the production machine. As mentioned, this is important in preserving the primary paths in multi path environments. (8 paths/dev in our environment)

Best of Luck.

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Sundar_7
Honored Contributor

Re: vgexport -p option

Umang,

I did mention the -s option so that you dont have list the PVs in the commandline. That is the trouble you have with the current commands u r trying

Sundar.
Learn What to do ,How to do and more importantly When to do ?
Umang Bhavsar
Occasional Advisor

Re: vgexport -p option

A.clay/Sridhar/Dave/Sundara,

Thanks for reply. But No body have replied my 2nd question. If i want to restore same volume group. if you have exported volume group with only -m option. Which way now i can restore volume group without recreating it ? If I would use -p -s option in vgimport would that work ? or not ?
Umang
Sridhar Bhaskarla
Honored Contributor

Re: vgexport -p option

Hi Umang,

If you have used only "-m" option, then you will need to specify the corresponding disks of the volume groups. For ex., c1t2d0 and c1t3d0 are the disks in the volume group, then you would say

#mkdir /dev/vgxx
#mknod /dev/vgxx/group c 64 0x0?0000 (replace ? with a unique number less than maxvgs kernel parameter)
#vgimport -v -m your_mapfile vgxx /dev/dsk/c1t2d0 /dev/dsk/c1t3d0

If you don't have the list of the disks, then look at your /etc/lvmconf/vgxx.conf file. Do a "strings" on it and get the disks. You can put them all in one file and use "-f" option with the vgimport.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sundar_7
Honored Contributor

Re: vgexport -p option

Umang,

Just curious..why would u like to just export and import it...is it for learning purpose or something ?

Once u export the VG with any option except -p option, you HAVE to create the volume group.

vgimport with -p and -s option wont do the trick for you. vgimport command requires the VG directory and the group file to be present.
Learn What to do ,How to do and more importantly When to do ?
Sundar_7
Honored Contributor

Re: vgexport -p option

Umang,

Just curious..why would u like to just export and import it...is it for learning purpose or something ?

Once u export the VG with any option except -p option, you HAVE to create the volume group.

vgimport with -p and -s option wont do the trick for you. vgimport command requires the VG directory and the group file to be present.
Learn What to do ,How to do and more importantly When to do ?
Sundar_7
Honored Contributor

Re: vgexport -p option

Umang,

Just curious..why would u like to just export and import it...is it for learning purpose or something ?

Once u export the VG with any option except -p option, you HAVE to create the volume group.

vgimport with -p and -s option wont do the trick for you. vgimport command requires the VG directory and the group file to be present.
Learn What to do ,How to do and more importantly When to do ?
A. Clay Stephenson
Acclaimed Contributor

Re: vgexport -p option

Actually, almost everyone answered your 2nd question as well -- we just can't give you an exact answer because we don't know and can't know your disk devices.

Here is an example:

mkdir -p /dev/vg10
chmod 750 /dev/vg10
mknod /dev/vg10/group c 64 0x0a0000
vgimport -m /tmp/vg10.map /dev/vg10 /dev/dsk/c12t1d6 [/dev/dsk/c1t5d3 ...]

BUT you must substitute the correct disk devices --- that is what the -s would have done for you but if you have already exported, it's too late.


NOTE: You can do a vgscan and it will try to find the disks.

A simple man of vgimport, vgexport, vgscan would have revealed all of this.
If it ain't broke, I can fix that.
Todd McDaniel_1
Honored Contributor

Re: vgexport -p option

One note about the -s option for vgexport...it it will save your bacon on the rare occasion where your H/W changes paths b/c of recabling issues...

______________________________________
If you are moving cables to your disks/EMC/Compaq frames and the hardware paths change, the -s option attaches a unique VGID so that upon vgimport you wont have to figure out what disks are associated with each VG...

I have seen this happen a few times... it is very easy with the -s option and VERY hard with out it... hehe


one solution I used to goback and do it with the -s option is to restore your LVM definitions in /etc/lvmconf/* and then redo the vgexport with the -s option...

Trust me it will always make your life easier...
Unix, the other white meat.
Nagaraju Gudala
Occasional Advisor

Re: vgexport -p option

Hi,
vgexport -p is the preview option of vgexport.u can go through man pages for vgexport