Operating System - HP-UX
1834136 Members
2485 Online
110064 Solutions
New Discussion

any way to merge two vg's without moving data

 
SOLVED
Go to solution
Hanry Zhou
Super Advisor

any way to merge two vg's without moving data

I want to combind vg01 and vg02 to vg01 only, in order to make it as the shared vg in SG.

As I know, I have to copy all file systems in vg02 to somewhere else, and copy them back to fs's in vg01. Is there any better way to achieve this?

Thanks,
none
11 REPLIES 11
Doug O'Leary
Honored Contributor

Re: any way to merge two vg's without moving data

I don't believe there is a way to merge vgs. You'll have to copy the data.

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Pete Randall
Outstanding Contributor

Re: any way to merge two vg's without moving data

Frankly - no.


Pete

Pete
Steven E. Protter
Exalted Contributor

Re: any way to merge two vg's without moving data

No.

You have to back them up, break them down and rebuilt the volume group from scratch.

I would suggest the -p parameter when re-run vgcreate.

Do take care to set that number to a reasonably high level, but below the default of 255.

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
melvyn burnard
Honored Contributor
Solution

Re: any way to merge two vg's without moving data

In a word: no
You would have to back up the data from the one VG, destroy the VG, add the PV's from this VG into the other VG an dthen recover your data after creating or extending LV's/Fs
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
HGN
Honored Contributor

Re: any way to merge two vg's without moving data

Hi

Well like all the experts have mentioned and what I know you cannot merge the vg.

If you think all of them answered your questions you can assign points and close the thread.

Rdgs

HGN
Hanry Zhou
Super Advisor

Re: any way to merge two vg's without moving data

2 more questions:

1. the service has to be interrupted. Right?

2. any estimate on how long it would take to copy total of 40g data from one FS to another?

Thanks!
none
TwoProc
Honored Contributor

Re: any way to merge two vg's without moving data

1. Yes
2. That just really depends on how fast your systems are for backing up and restoring. And the answers are varied b/c of the many questions: Are you using disk or tape? If it's disk - is it local? jbod? Really fast storage arrays? mid-tier arrays? small scsi arrays ?

The only way to estimate it is to back up a fraction of it to whereever it is you're going to back up to - say test it with 4G (1/10 of the data).

So you're looking at:
A) Time to backup (10 times above number)
B) Time to take down two VG's (15 min) (document them first!)
C) Create new VG and put disks in. Time will vary based on whether or not you are using Mirroring software, or its hardware mirroring. time: 5-20 minutes (software mirroring) - 2 hours to 16 hours - depending - rough guesses.
D) Restore from tape/disk. See time A) for disk, be willing to multiply X 2 for disk.
We are the people our parents warned us about --Jimmy Buffett
Bharat Katkar
Honored Contributor

Re: any way to merge two vg's without moving data

Hi,
Just a rough estimate for downtime:

1. Backup 2 hrs.
2. destroy vg02 and add freed PV's to vg01, create Volume/FileSystems 1 hrs.
3. Restore 2 hrs.

So i look at it as aorund 5 hrs activity.
Totally a guess. Commit as per your setup/convenience.

Regards,
You need to know a lot to actually know how little you know
Devender Khatana
Honored Contributor

Re: any way to merge two vg's without moving data

Hi,

You need to backup the data from any of the one VG and restore it back. Select one to be backup up with less data to reduce the time.

Also check following parameters through vgdisplay command in the two VGs if all the devices in the VG's are not of same size.

1)PE_Size

2)MAX_PE_PER_PV

Steven,

I did not understand the importance of -p here as the default value of max. PV we can have in a VG is 16 which is hardly required to be exceeded. A more stress should be given to adjust PE_Size and MAX_PE_PER_PV as these are required to include the large size disks in existing VGs (Which always happens) as disk with same size is not always available.

HTH,
Devender
Impossible itself mentions "I m possible"
CAS_2
Valued Contributor

Re: any way to merge two vg's without moving data

The general answer is NO. You cannot merge 2 VGs... but some day I tried the following:

1. Created a new VG on a empty disk.
2. Created a new logical volume on that VG.
3. Created a new file system on this lvol. I mounted and store data.
4. unmounted and remove VG.

5. Created again the VG on the same disk.
6. Created a new logical volume. Every LE/PE of this new lvol matched every LE/PE of old lvol previously removed (step 2).
7. mounted old file system (no mkfs needed)
8. checked the data stored are ok.

This trial worked fine because of steps 5 and 6: every LE/PE of newest lvol matched every LE/PE of old lvol.
Perhaps this is difficult to get. For instance, if your lvol use stripes, or has an unusual distribution on the disks, or newer VG has a PE size different than older one... or other reasons that I don't know.
Steve Post
Trusted Contributor

Re: any way to merge two vg's without moving data

fyi: it's good to have spare disks at times. Why? I allows you do what you run backup and recovery for just the vg02 filesystems onto a spare disk (or disks).

Use "cpio -p" to move from disk to disk.

I assume you are talking just filesystem data here: files and directories.
I assume you have a big disk equal to or bigger than all of the vg02 filesystems you are moving. I'll call it /bigdisk.


1. find all the filesystems used by vg02.
For example:
/dev/vg02/lv01 /disk2/A
/dev/vg02/lv02 /disk2/B

2. you have a utility disk that is bigger than the /disk2/A + /disk2/B.

3. mkdir -p /bigdisk/disk2

4. cd /disk2
5. find A -print | cpio -pdumvc /bigdisk/disk2.
6. find B -print | cpio -pdumvc /bigdisk/disk2.
7. umount /disk2/A; umount /disk2/B
8. get rid of vg02.
9. add the vg02 disks to vg01.
10. make 2 new logical volumes for disk2/A and disk2/B. (let's call them vg01/lv08 and vg01/lv09.
11. mount /dev/vg01/lv08 /disk2/A
mount /dev/vg01/lv09 /disk2/B

Now the recovery part.
12. cd /bigdisk/disk2/A
find . -print | cpio -pdumvc /disk2/A
13. cd /bigdisk/disk2/B
find . -print | cpio -pdumvc /disk2/B

Now your data is back and the vg02 logical volumes (2 of them here), are on vg01.

14. You need to trash the temp copy of disk2/A and disk2/B.
cd /bigdisk
rm -r disk2

That's it.
Obviously this method has tons of assumptions. But if it works, you might be able to save loads of time.

OH! You obviously can't have people using the data on /disk2/A and /disk2/B while you are moving it. So there still is down time involved. And this cpio process might take up a lot of processing time. But still, disk to disk copying is usually faster than disk to tape.

Steve