Operating System - HP-UX
1833056 Members
2267 Online
110049 Solutions
New Discussion

Need vgimport with correct lvm name

 
SOLVED
Go to solution
Aungshuman Paul
Regular Advisor

Need vgimport with correct lvm name

Hi,

One of the system has two VG. We create some LV on that VG using some name which will reflect the corresponding mount point. Like lvoracle for /oracle mount point.

Now my question how can I restore the VG with appropriate LV name . Normal vgimport command activate the VG with lvol1, lvol2 etc. but I want to restore as lvorcale etc.

What is the exact procedure?


Waiting for valuable reply.


Aungshu


11 REPLIES 11
kunjuttan
Super Advisor

Re: Need vgimport with correct lvm name

First create new device file and then import the Vg,
# ll /dev/*/group
# mkdir /dev/vg01 (you could also choose another VG name)
# mknod /dev/vg01/group c 64 0x##0000
Now copy the mapfile from system A and import the VG:
# vgimport -v -s -m /tmp/vg01.map vg01

now you can rename the LV
# umount /dev/vg01/lvol1
# mv /dev/vg01/lvol1 /dev/vg01/lvdata
# mv /dev/vg01/rlvol1 /dev/vg01/rlvdata
# mount /dev/vg01/lvdata
Aungshuman Paul
Regular Advisor

Re: Need vgimport with correct lvm name

Thanks for reply. I know I can rename the LV after import the VG but in my case the system has more than 30 LVM. It is really difficult to rename the LVM.

Any other way that I restore the LVM as my original LVM name ?


Aungshu


Svetoslav Gyurov
Valued Contributor

Re: Need vgimport with correct lvm name

Hi,

If you export the volume group to map file it will export the logical names with their names. So later when you import the volume group it will be imported with the same logical volume names. There is no other way keep the names of the logical volumes.

This is how you export it:
vgexport -p -v -m vg01.map vg01

And this is how you import it:
vgimport -p -v -m vg01.map vg01 /dev/disk/diskX

The case where vgimport imports the logical volumes with lvol1, lvol2 and so on is when you don't have a map file and execute vgimport without this option.


Regards,
Sve
R.O.
Esteemed Contributor

Re: Need vgimport with correct lvm name

Hi,

Doing

vgexport -p -m .map /dev/

will create a mapfile with the name of the original logical volumes for this vg. If you do

vgimport -m .map /dev/

..you will have the vg with the original lv names.

Regards,
"When you look into an abyss, the abyss also looks into you"
Aungshuman Paul
Regular Advisor

Re: Need vgimport with correct lvm name

Hi,

Thanks for the post. But when I execute the commnad it shows following error:

vgexport -p -v -m vgtest1.map vgtest1 /dev/dsk/c0t2d0
Usage: vgexport
[-m mapfile]
[-p]
[-v]
[-f OutFile]
VolumeGroupName

vgexport
[-m mapfile]
-s [-p] [-v] VolumeGroupName
"/dev/dsk/c0t2d0": Too many arguments
kunjuttan
Super Advisor

Re: Need vgimport with correct lvm name

try with this

# vgchange -a n vgtest1
Export the VG:
# vgexport â v -s -m /tmp/vgtest1.map vgtest1
kunjuttan
Super Advisor

Re: Need vgimport with correct lvm name

try with this

# vgchange -a n vgtest1
Export the VG:
# vgexport -v -s -m /tmp/vgtest1.map vgtest1
R.O.
Esteemed Contributor
Solution

Re: Need vgimport with correct lvm name

Hi,

It must be:

vgexport -p -v -m vgtest1.map vgtest1

without the disk device file.

If you also want a map of the disks, you mast do:

vgexport -p -v -m vgtest1.map -f vgtest1.dsk vgtest1

or

vgexport -p -v -s -m vgtest1.map vgtest1

(note the "-s"). The resulting mapfile will have the vgid and in the vgimport phase, it will search for those disks with that vgid.

Regards,
"When you look into an abyss, the abyss also looks into you"
stephen peng
Valued Contributor

Re: Need vgimport with correct lvm name

you do not need to specify a PV_name when you try to restore your VG using vgimport
Aungshuman Paul
Regular Advisor

Re: Need vgimport with correct lvm name

Thanks Svetoslav Gyurov. I can successfully reover the LVM.

vgimport -v -m vgtest1.map /dev/vgtest1 /dev/dsk/c0t2d0

Beginning the import process on Volume Group "/dev/vgtest1".
Logical volume "/dev/vgtest1/lvtest2" has been successfully created
with lv number 2.
Logical volume "/dev/vgtest1/lvtest1" has been successfully created
with lv number 1.
vgimport: Volume group "/dev/vgtest1" has been successfully created.
Warning: A backup of this volume group may not exist on this machine.
Please remember to take a backup using the vgcfgbackup command after activating the volume group.


Aungshu
stephen peng
Valued Contributor

Re: Need vgimport with correct lvm name

sorry about my typo. you should relate your vgepxort to your vgimport behavier. and just read the man page of vgexport and vgimport, you will get more understanding.