LVM and VxVM

Can I setup a mirror to a different volume group

 
SOLVED
Go to solution

Can I setup a mirror to a different volume group

I am tring to setup LVM mirroring but the vg was setup with the mav PV = 6 and there are already 6 disks in the vg. So I would like to either change to max PV to a higher number or create a new vg and mirror the lvols from the original vg to the new vg. Any suggestions?
for RC ( John Creighton )
8 REPLIES 8
Pete Randall
Outstanding Contributor
Solution

Re: Can I setup a mirror to a different volume group

Dennis,

If you're talking about using MirrorDisk/UX, the answer is no. Mirroring with this product is done on an lvol basis, thus both lvols have to belong to the same VG.

If you're talking some form of manual or hardware mirroring then the answer may be different.


Pete

Pete
Patrick Wallek
Honored Contributor

Re: Can I setup a mirror to a different volume group

You can't do either one.

To change the MAX PV setting, you must remove and recreate the VG as this is set at VG creation time.

You also can not mirror between VG's. That doesn't work as mirroring is done at the LVOL level.

What you could do is create a new VG with your disks you want to mirror to (be sure to make MAX PV large enough) and copy your data to those disks and mount your filesystems from the new VG. Then you can remove the old VG, pvcreate the disks, and vgextend them into the new VG. Now you can mirror your data onto those disks.
Sridhar Bhaskarla
Honored Contributor

Re: Can I setup a mirror to a different volume group

Hi,

1. You cannot change max PV once the VG is created.
2. You cannot mirror the lvols across VGs.

So, what you can do is to setup a new VG with non-default options (look at vgcreate for more information). Once the new VG is setup, create logical volumes of the same size as in old VG, mount them on temporary mount points, copy the data from the old vg to new VG. Unmount old Lvols and mount the new ones and update /etc/fstab to reflect the new VG name. Remove the old VG once the copy is successful and the application tested. Add the disks that got freed from the old VG to new VG and establish mirroring.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Steven E. Protter
Exalted Contributor

Re: Can I setup a mirror to a different volume group

Last I checked you can't do that.

Time to build a new volume group with -p max_pv set higher.

Backup up the data
destory logical volumes
vgreduce the disk out of the old volume group
vtextend the new volume group to the new disks
restore the data.

There may be shortcuts but they scare me.

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

Re: Can I setup a mirror to a different volume group

Thanks all.
So it sounds like I cannot do this without taking an outage of the file systems in the volume group I want to mirror.

Is there anyway to export the lvols out of the original volume group and import them into a new volume group with larger PV settings so I don't have to copy the data?
for RC ( John Creighton )
Sridhar Bhaskarla
Honored Contributor

Re: Can I setup a mirror to a different volume group

Hi Dennis,

Unfortunately the answer is no. You will have to copy the data from old VG to new VG.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Pete Randall
Outstanding Contributor

Re: Can I setup a mirror to a different volume group

Dennis,

Unfortunately, there aren't any lvmove type commands. The best substitute, if you have the room, is to create a new VG and new lvols within it, then move the data over.

Otherwise, it's backup, destroy, re-create, and restore.


Pete

Pete
Clay Jordan
Advisor

Re: Can I setup a mirror to a different volume group

One thing than can save you time on doing a copy is to use dd on the raw lvols instead of copy. To do this, the lvols must be the same size or larger and you would use `dd if=/dev/vgXX/lvolZ of=/dev/vgYY/lvolZ bs=64K`. If you make the lvols larger than current, you will need to extend the file systems later.

If on another note you are limited on downtime and you have OnlineJFS with sufficient diskspace, you could take a snapshot and do a vxdump or file copy, thus reducing your downtime.