Operating System - HP-UX
1833083 Members
4202 Online
110050 Solutions
New Discussion

moving LV,FS and data between VGs

 
Inesa Clinko
Advisor

moving LV,FS and data between VGs

Hi all !
I would like to ask a algoritm question.
Suppose I have a /dev/VG1, based on PV1,PV2,PV3,PV4. On this VG I has /dev/VG1/LV1 and /dev/VG1/LV2,
with mounted file systems: /FS1 and /FS2, respectively.
On this VG1 I have a large sizes of /FS1 and /FS2: 200GB and 200GB

I want to create a new VG2, and move these LVs , FSs and data from VG1 to VG.
How I can do this step by step?
6 REPLIES 6
RAC_1
Honored Contributor

Re: moving LV,FS and data between VGs

In your case, you have option of exporting the VG1 and importing it as VG2.

1. First back it up-everything-cold backup
and may be two copies-just in case.
2. vgexport -vs -m /tmp/vg1.map /dev/vg1
3. mkdir /dev/vg2
mknod /dev/vg2/group c 64 0x020000
0x020000 - is the minor number for vg2. Make sure that it is not duplicated anywhere.
vgimport -vs -m /tmpvg1/map /dev/vg2

The lvolv names would be same as they were in vg1.

Anil
There is no substitute to HARDWORK
Inesa Clinko
Advisor

Re: moving LV,FS and data between VGs

Thanks,it is great. But another question:

The reason to do this is my desire to increase the size of PE for 32 /in old VG1/ to 64 /in new VG2/. How to implement this, according to your migration plan. :)

David Child_1
Honored Contributor

Re: moving LV,FS and data between VGs

It depends on why you want/need to do this;

1. If the reason you want to move them from vg1 to vg2 is to get them on new disks you could do the following (this is assuming you have MirrorDisk/UX and the LVs are not striped);

a. add the new disks into vg01 (pvcreate;vgextend)

b. use pvmove to get all the extents from the current set of disks to the new disks (you could also use lvextend to mirror to new disks and then lvreduce to remove old disks)

c. remove the old disks from vg1 (vgreduce)

d. export/import volume group as RAC mentioned

2. If you just want to change the name from vg1 to vg2 you can do exactly what RAC mentioned

3. If option 1 and 2 are not valid then you may need to do this;

a. create /dev/vg2 (pvcreate, mkdir, mknod, vgcreate)

b. create lv1 and lv2 in vg2 as desired (lvcreate)

c. make file systems on lv1 and lv2 as desired (mkfs)

d. mount /dev/vg2/lv1 and /dev/vg2/lv2 on /FS1_new and /FS2_new.

e. use cpio to copy all files and data from /FS1 -> /FS1_new and /FS2 -> /FS2_new

f. unmount /FS1 and /FS2 and mount /dev/vg2/lv1 to /FS1 and /dev/vg2/lv2 to /FS2

g. remove /FS1_new and /FS2_new

David
David Child_1
Honored Contributor

Re: moving LV,FS and data between VGs

Sorry Inesa, I was typing up my response and didn't see your last post where you talked about wanting to change PE definition.

In this case I believe your only option is item #3 from my last post.

Obviously you can use other methods to restore data (NetBackup, fbackup, etc.), but you will need to create a new volume group from scratch.

David
Sridhar Bhaskarla
Honored Contributor

Re: moving LV,FS and data between VGs

Hi Inesa,

I don't usually attach forum's threads. But this is the latest one I posted in another thread. You can use it except that you don't have to drop the alternate links etc., You can use fbackup to copy the data from old VG to new VG.

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=693893

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

Re: moving LV,FS and data between VGs

I am assuming you have additional disks available such as PV5,PV6, etc. The simplest way is to use sam and go to the "Disks and File Systems" then select "Volume Groups". Now press the TAB key and use the arrow keys to move over to "Actions" and select the drop-down item: "Create" and type in the new volume group name: VG2. In the next step, SAM will scan for unused disks. Select the ones that you would like to use. You can then select logical volumes and define as many as you would like. You can pick mounted filesystem name(s) for the LVs. To copy all the data, you can use cpio disk-to-disk unless there are files larger than 2Gb. Then you can use fbackup/frecover to copy the data to the new filesystem(s).

Without using SAM, you would have to provide many details about the


Bill Hassell, sysadmin