1833105 Members
3228 Online
110051 Solutions
New Discussion

vgexport/vgimport

 
Teck Sim
Frequent Advisor

vgexport/vgimport

# vgexport -m vg01.mymap /dev/vg01

Volume group "/dev/vg01" is still active.
vgexport: Couldn't export volume group "/dev/vg01".

anyone?
thanks.
22 REPLIES 22
S.K. Chan
Honored Contributor

Re: vgexport/vgimport

Deactivate your VG first before you vgexport it.

# vgchange -a n /dev/vg01
PIYUSH D. PATEL
Honored Contributor

Re: vgexport/vgimport

Hi,

vgchange -a n /dev/vg01

This deactivates your volume group.

Piyush
Stefan Farrelly
Honored Contributor

Re: vgexport/vgimport


Do a vgchange first to deactivate the VG;

vgchange -a n vg01
Im from Palmerston North, New Zealand, but somehow ended up in London...
Teck Sim
Frequent Advisor

Re: vgexport/vgimport

# vgchange -a n vg01

vgchange: Couldn't deactivate volume group "vg01":
Device busy
PIYUSH D. PATEL
Honored Contributor

Re: vgexport/vgimport

Hi,

Which directory you are in ???

Go to the root directory and try.

Or else Unmount the filesystems on vg01.

Then try.

Piyush
S.K. Chan
Honored Contributor

Re: vgexport/vgimport

Are any of the logical volumes in vg01 still mounted as filesystem ?
# bdf | grep vg01
If they are you got to unmount them first. Does it has swap logical volume still in use ?
# swapinfo -tam
If yes that logical volume need to be free up first.
Teck Sim
Frequent Advisor

Re: vgexport/vgimport

It's ok now. I was able to vgexport after I umount the directory:

# umount /dev/vg01/d01
# umount /dev/vg01/d02
# umount /dev/vg01/d03

# vgchange -a n /dev/vg01
Volume group "/dev/vg01" has been successfully changed.

Thanks.
James R. Ferguson
Acclaimed Contributor

Re: vgexport/vgimport

Hi Teck:

Make sure you are not CD'd into a mounted directory on the volume group's logical volume and unmount all logical volumes associated with the volume group. Then reissue the 'vgchange -a n' and do your 'vgexport'.

Regards!

...JRF...

You can use 'fuser -
Joseph A Benaiah_1
Regular Advisor

Re: vgexport/vgimport

Teck,

You first need to stop all IO to the disks in that VG which means shutting down the relevant applications and killing off any processes using the file systems in vg01.

Cheers,

Joseph.
Sanjay_6
Honored Contributor

Re: vgexport/vgimport

Hi,

you have to first deavtivate the vg. unmount all the filesystems from this vg, then dectivate the vg,

vgchange -a n /dev/vg01

Then do a vgeport,

vgexport -s -m /tmp/vg01.map /dev/vg01


to import the same on another system copy the map file /tmp/vg01.map to another system,

mkdir /dev/vg01
mknod /dev/vg01/group c 64 0x010000
vgimport -s -m /tmp/vg01.map /dev/vg01

Hope this helps.

Regds
Teck Sim
Frequent Advisor

Re: vgexport/vgimport

after I vgexport:
# vgexport -m vg01.mapfile /dev/vg01

and then I did a cold install
and the I did the following:

# mkdir /dev/vg01
# mknod /dev/vg01/group c 64 0x010000
# vgimport -m vg01.mapfile /dev/vg01
vgimport: Couldn't open MAPFILE "vg01.mapfile".
vgimport: vg01.mapfile: No such file or directory

Help.
Thanks.
Patrick Wallek
Honored Contributor

Re: vgexport/vgimport

Where did you have the mapfile that you created? If it was located in any of the VG00 directories then it will have been wiped out when you did the cold install.

Hopefully you backed it up to tape before you did the cold install.
Alexandru_1
New Member

Re: vgexport/vgimport

hi,

first try to lacate your map file.
#find / -name vg01.mapfile
if you found this file repeat your vgimport commandt with corect path.

If you lost this file you can recover your vg if you remember witch disk was members of this vg or try with (pvdisplay -v /dev/dsk/cXtXdX | more) to see same lvm info from your disks.
For the next time when you use vgexport if you whant to recover your data from this vg use the command with -p -s (see man) -m

S.K. Chan
Honored Contributor

Re: vgexport/vgimport

In your earlier post, you had your map name as "vg01.mymap".
Sanjay_6
Honored Contributor

Re: vgexport/vgimport

Hi,

Can you post your mapfile

Thanks
PIYUSH D. PATEL
Honored Contributor

Re: vgexport/vgimport

Hi,

If the map file was saved in the root filesystem and if you have reinstalled the OS on the root harddisk then that map file is lost.

Do a vgscan and it will also find out your vg info.

#vgscan -a

Atleast recall the devices files and harddisks which were present in the vg01.

Piyush
MANOJ SRIVASTAVA
Honored Contributor

Re: vgexport/vgimport

Hi Teck

map file just contains the information for the no .of lvols in the volume group , incase you are doing a vgimport using a map file either ensure that the mapfile is in the direcotry where you are running the command or specify the path where the mapfile is present . Incase you dont ahve one , you can jsut do a

vgimport /dev/vg01 /dev/dsk/cxtydz /dev/dsk/cx1ty1dz1 etc abd it will read the vg information and reover the lvol as they were present on those disks.


Manoj Srivstava
Sandip Ghosh
Honored Contributor

Re: vgexport/vgimport

It seems that you were having only three logical volume on vg01. If you do not have the mapfile, do a vgimport without mapfile.
#vgimport /dev/vg01 /dev/dsk/cxtydz.

Then if you go to the /dev/vg01 directory you will get lvol1,lvol2,lvol3,rlvol1,rlvol2,rlvol3. Now you go to your old /etc/fstab file and change the device file name from
/dev/vg01/do1 to /dev/vg01/lvol1
/dev/vg01/do2 to /dev/vg01/lvol2
/dev/vg01/do3 to /dev/vg01/lvol3

Hope this helps

Sandip
Good Luck!!!
Teck Sim
Frequent Advisor

Re: vgexport/vgimport

# vgscan -a
vgscan: The physical volume "/dev/dsk/c0t6d0" is already recorded in the "/etc/.
Physical Volume "/dev/dsk/c0t2d0" contains no LVM information

Following Physical Volumes belong to one Volume Group.
Unable to match these Physical Volumes to a Volume Group.
Use the vgimport command to complete the process.
/dev/dsk/c0t5d0

The Volume Group /dev/vg01/group was not matched with any Physical Volumes.

# vgimport /dev/vg01 /dev/dsk/c0t5d0
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.
# vgchange -a y vg01
Activated volume group
Volume group "vg01" has been successfully changed.

# vgdisplay -v vg01
--- Volume groups ---
VG Name /dev/vg01
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 3
Open LV 3
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 1023
VGDA 2
PE Size (Mbytes) 4
Total PE 1023
Alloc PE 150
Free PE 873
Total PVG 0

--- Logical volumes ---
LV Name /dev/vg01/lvol1
LV Status available/syncd
LV Size (Mbytes) 200
Current LE 50
Allocated PE 50
Used PV 1

LV Name /dev/vg01/lvol2
LV Status available/syncd
LV Size (Mbytes) 200
Current LE 50
Allocated PE 50
Used PV 1

LV Name /dev/vg01/lvol3
LV Status available/syncd
LV Size (Mbytes) 200
Current LE 50
Allocated PE 50
Used PV 1


--- Physical volumes ---
PV Name /dev/dsk/c0t5d0
PV Status available
Total PE 1023
Free PE 873

Should I do a mount or ....
so that when I do a bdf, the vg01 will show up in my file system.

Thanks
Patrick Wallek
Honored Contributor

Re: vgexport/vgimport

Nothing will show up in 'bdf' output until you actually mount the LV's within VG01.

Do you have a copy of your /etc/fstab from before you did the cold install so that you can remount you LV's as they were before?
S.K. Chan
Honored Contributor

Re: vgexport/vgimport

Yes mount them (for example ..I'm assuming lvol1->lvol3 have pre-existing filesystems)
# cd /
# mkdir /data1 /data2 /data3
# mount /dev/vg01/lvol1 /data1
# mount /dev/vg01/lvol2 /data2
# mount /dev/vg01/lvol3 /data3
Make sure you edit /etc/fstab file to make these mountpoints stick at every reboot.
PIYUSH D. PATEL
Honored Contributor

Re: vgexport/vgimport

Hi,

Make new directories and mount the filesystems. Make the entries in /etc/fstab also so that they get mounted during the next reboot.

mount /dev/vg01/lvol1 /data1.....

You can also go to SAM - Filesystems and then mount these filesystems and hence you may not manually edit the /etc/fstab file.

Piyush