1855899 Members
7683 Online
104107 Solutions
New Discussion

Re: Copying a VG

 

Copying a VG

Hello there,

I have VG called VG01 with 4 disks in it sitting on server1. I have another 4 disks that I present to another server called server2.

Is there some fancy way of copying the VG config AND data of VG01 to the 4 new disks on server2 so that server2 VG01 is identical to the server1 VG01?

I could just re-create the VG and manually recreate the LV's/filesystems and set permissions etc but that would be a pain.

your thoughts appreciated.

Kind regards,

Mohammed U. Ali
mu.ali@ntlworld.com
Life is what you make it!
10 REPLIES 10
Steven E. Protter
Exalted Contributor

Re: Copying a VG

vgexport
deactivate the volume group

vgimport

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Mark Grant
Honored Contributor

Re: Copying a VG

I think you should recreate the volume group and logical volume information and restore from a tape.

You can re-create the LVM information on the other machine with "vgexport -m /tmp/mapfile -p vg01" and then copy the mapfile to the other machine and "vgimport -m /tmp/mapfile -p vg01" but you still need to create /dev/vg01/group and it will not copy the data. You may as well do the whole thing manually and if you restore from a tape, you won't have the permissions problem.

Oh, and don't forget to update /etc/fstab either
Never preceed any demonstration with anything more predictive than "watch this"
Marco Santerre
Honored Contributor

Re: Copying a VG

I don't think there is a miracle solution in your case, unless you are using a disk array and that you can associate the disks on server2 to be some type of BCV for the disks on server1.

Other than recreating the Volume Group and restoring the data from tape or from tar or any other copy utility you like, I don't think there is an easy way out of this one.
Cooperation is doing with a smile what you have to do anyhow.

Re: Copying a VG

Yeh thanks...

I thought as much. I'll probably just import mapfile and restore from tape.

Funny you should mention the BC option. I was considering doing that but then wondered if it was a shortcut or (probably) a longer one :)

Thanks guys.

Kind regards,

Mohammed.
Life is what you make it!
Marco Santerre
Honored Contributor

Re: Copying a VG

Well, it's true, it all depends how much time the setup will take you, and most importantly, it's a one time deal, so that means, you would want to crash that setup with the BC afterward, so in the end, it might be more trouble just to do the setup, especially only for 4 disks.
Cooperation is doing with a smile what you have to do anyhow.
Geoff Wild
Honored Contributor

Re: Copying a VG

Best way would be to manually create the VG and file systems then run a backup / alternate restore...



Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Patrick Wallek
Honored Contributor

Re: Copying a VG

vgimporting will *NOT* work in this case. vgimport works by reading the VG information from the VGRA on the disk. Since the disks on system 2 are different from system1, the VG information on them, if there is any, will not be what you want.

vgexport / vgimport will only work if you export the VG from server1, remove the disks from server1, attach the disks to server2, and then vgimport.

vgexport / vgimport is not designed to replicate a VG configuration between different sets of disks.

You will have to recreate the VG from scratch.
Mark Grant
Honored Contributor

Re: Copying a VG

Patrick,

I was under the impression that vgimport only queried the disks when you have the "-s" option enabled. Have I been deluding myself again?
Never preceed any demonstration with anything more predictive than "watch this"
Patrick Wallek
Honored Contributor

Re: Copying a VG

Mark,

Sorry to say, yep you have been. ;) The '-s' option allows you to more easily import the VGs since you don't have to specify each and every disk on the vgimport command line. The '-s' may actually add an extra disk read into the vgimport since it is looking for all disks with the VGID that is specified in the map file.

Anyway, when you use vgimport it will look at all the disks, since each has a VGRA on it and get the LV information from all of the disks. It uses this information to figure out which LVs reside on which disks and what the sizes are.

Mark Grant
Honored Contributor

Re: Copying a VG

Patrick,

Thanks for taking the time to clear that up.

Regards
Never preceed any demonstration with anything more predictive than "watch this"