Operating System - HP-UX
1822845 Members
4276 Online
109645 Solutions
New Discussion юеВ

two mirror copies in the same command

 
SOLVED
Go to solution
RUET
Regular Advisor

two mirror copies in the same command

Hi guys
I'm adding two big LUN to my existing vg, to make some mirror copies. The actual VG has one big LUN at the moment.

Is there is a way to build the two mirros in the same command , by example, starting from this single LUN vg, and running the lvextend -m 2 on the lvol ?

My goal is if possible to avoid the lvextend -m 1 and then lvextend -m 2 because of I don't have a big time to recreate the mirror copies ..

Thanks in advance
Pat
10 REPLIES 10
James R. Ferguson
Acclaimed Contributor

Re: two mirror copies in the same command

Hi Pat:

> Is there is a way to build the two mirros in the same command , by example, starting from this single LUN vg, and running the lvextend -m 2 on the lvol ?

Yes, do, either:

# lvextend -m 2 /dev/vgNN/lvolX

...or specifically specify the volumes like:

# lvextend -m 2 /dev/vgNN/lvolX /dev/dsk/cXtYdZ /dev/dsk/cXXtYYdZZ

Regards!

...JRF...
RUET
Regular Advisor

Re: two mirror copies in the same command

JRF thanks for this fast response

I have one existing lvol, i want to mirror 2 times, first copie on the first new LUN and second copie on the second new LUN?
Is the command
lvextend -m 2 /dev/vgxx/lvol /dev/dsk/c0t0d3 /dev/dsk/c0t0d4 will insure me that all copies are on different disks ? or do I have to play with LV or VG attribute ?

Re- thanks in advance

pat
James R. Ferguson
Acclaimed Contributor
Solution

Re: two mirror copies in the same command

Hi (again) Pat:

By default, when you did your 'lvcreate' the allocation policy was set to 'strict'. This means that mirrored copies cannot share a common physical volume. You can verify the policy with a simple 'lvdisplay'. Hence either command I showed should work equally well.

Regards!

...JRF...
RUET
Regular Advisor

Re: two mirror copies in the same command

Great
I have now to check that one lvextend -m 2 is faster than two sequential lvextend -m 1 ...

many thankks jfr

pat
RUET
Regular Advisor

Re: two mirror copies in the same command

And one last question
If I do a mirror to a new LUN with a specific path, if I change the path later is the mirror still OK, or is the mirror broken ?
James R. Ferguson
Acclaimed Contributor

Re: two mirror copies in the same command

Hi (again) Pat:

> If I do a mirror to a new LUN with a specific path, if I change the path later is the mirror still OK, or is the mirror broken ?

First, you can't have more than 2-copies (3-sets) of a logical volumes extents.

If you want to eliminate mirrored extents from one physical volume and establish them on another physical volume, you 'lvreduce' the mirror on the physical volume you no longer want used, deallocating (freeing) its physical extents; and then you 'lvextend' new mirrored extents on the new physical volume.

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: two mirror copies in the same command

Hi (again) Pat:

One more comment. If you are really paranoid, and have 1-mirror (2-copies of a logical volume) and you want to move a mirror from an old physical volume to a new one, you can _add_ another mirror to the _new_ physical volume ('lvextend -m 2') and then 'lvreduce' the extents on the physical volume you no longer want. In this scenario and fashion, you always maintain two copies of your data at all times.

Regards!

...JRF...
RUET
Regular Advisor

Re: two mirror copies in the same command

Hi again JRF ..
thanks for all the comments, I appreciate them.

I"'m not paranoid, maybe my customer ..
My last question was may be not clear ..
my idea, is, I have a lvol on an old LUN
I made a mirror to a new LUN, but because of not today complete SAN architecture, i will move later this new LUN owning the mirror to a new FC card, so a new LUN PATH..

If I extend the VG with this new path , is my this new path will be seen owning correctly the mirror, or do I have to reduce mirror to 0, reduce the VG with the old path and extend the VG with new path and redo the mirror

thanks again ...
johnsonpk
Honored Contributor

Re: two mirror copies in the same command

Hi Pat ,

If you can arrange a downtime for that VG ,I would go with a Vgexport import process as it is less time consuming.

Steps.

#Note down vg minror and major number
ll /dev//group
create map files for the vg( vgexport in preview mode)

#vgexport -p -s -v -m /tmp/.map /dev/vgname

unmount all fs using that volume group

deactivate vg
#vgchange -a n

export vg from system

#vgexport /dev/

present the lun through new Fc and do ioscan,insf to create device file for new path

create vg directory and group special file with mknod command

import vg with map file (-s option allows lvm to create vg by searching PV ID in each disk)
#vgimport -s -v -m /tmp/.map /dev



If it is 11iv3 with pdsf device attched to Vg ,you dont have to worry about all these..as lvm maps disk with LUN wwn number.


>>If I extend the VG with this new path , is my this new path will be seen owning correctly the mirror, or do I have to reduce mirror to 0, reduce the VG with the old path and extend the VG with new path and redo the mirror

If you are moving only one LUN ,then you can reduce mirror to one from two and extend it later to 2 with new path ..

#lvreduce -m 1

then reduce it from vg if there no lv created on that disk
vgreduce vgname>

after san activity
add the disk to vg
then extend mirror
#lvextend -m 2

Regards !
Johnson
Bill Hassell
Honored Contributor

Re: two mirror copies in the same command

If you do not have data on the original LUN, there is a very fast method for mirroring. Create the LUN without a size (it will show as size 0). Then extend the LUN for 1 or 2 mirrors. This will complete instantly because the data on the primary is 0 length. Now extend the LUN to the desired size. The volume will now mirror the data as it is restored to the LUN -- no separate mirroring step.


Bill Hassell, sysadmin