Operating System - HP-UX
1833679 Members
4394 Online
110062 Solutions
New Discussion

Re: Avoiding mirror synchronization on new LV creation

 
Jay Kidambi
Advisor

Avoiding mirror synchronization on new LV creation

Using command line, is there a way to avoid the synchronization of mirrored disks when creating a logical volume?

Here are the commands we are using to create the LV:

# lvcreate -n lv_foo -s g /dev/vg_foo
# lvextend -L 32768 /dev/vg_foo/lv_foo /dev/dsk/c4t3d0
# lvextend -m 1 /dev/vg_foo/lv_foo /dev/dsk/c4t4d0 --> this step takes too long synchronizing the mirror.

Isn't mirror sync useless because the LV was just created?
6 REPLIES 6
Hoang Minh Tuan
Regular Advisor

Re: Avoiding mirror synchronization on new LV creation

hi Jay Gurus,

You create a new lv with size 32GB so it's a quite big and take time when you make mirror to another disk. The mechanism of mirroring is do not care how data lv has. It mean that it take the same time to mirror lv if it 's just created or containing full data.

If it take time and want to cancel it, let 's do lvreduce -m 0 dev/vg_foo /dev/dsk/c4t4d0 or force to reduce by using pv_key.
Issuing following command to get PV_key:
lvdisplay -vk /dev/vg_foo/lv_foo
lvreduce -m 0 -k PV_key /dev/vg_foo/lv_foo

Thanks and hope it help,
HMT
Bus wait at bus station, Work wait at my work station
Steven E. Protter
Exalted Contributor

Re: Avoiding mirror synchronization on new LV creation

Skip this step.

# lvextend -m 1 /dev/vg_foo/lv_foo /dev/dsk/c4t4d0 --> this step takes too long synchronizing the mirror.

When this step finishes the mirror is done.

This steps creates the mirror, fresh and clean.

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
Bill Hassell
Honored Contributor

Re: Avoiding mirror synchronization on new LV creation

You wrote:

> Isn't mirror sync useless because the LV was just created?

Yes, that's correct. Effectively the disk is blank and every write to the disk will be automatically mirrored. But there is a secret to creating an lvol without a lengthy sync. Create the smallest lvol you can (one extent), then mirror that (very fast). Now extend the lvol to the desired size. And now you have any size lvol (terabyte) fully mirrored. You can verify this with the lvdisplay -v command. Here's how you can do it with your example:

# lvcreate -l 1 -n lv_foo -s g /dev/vg_foo
# lvextend -m 1 /dev/vg_foo/lv_foo
# lvextend -L 32768 /dev/vg_foo/lv_foo /dev/dsk/c4t3d0

The above commands will take just a few seconds.


Bill Hassell, sysadmin
DCE
Honored Contributor

Re: Avoiding mirror synchronization on new LV creation

The method described by Bill works extremely well - it will mirror you lvol almost immediately. There is one thing to be aware of - make sure your LV is set up correctly to ensure you do not place the mirror on the same disk as the original LV. you can also explicitly specify the disks to ensure the mirror goes where you want when you issue the lvextend command the
Devender Khatana
Honored Contributor

Re: Avoiding mirror synchronization on new LV creation

Hi,

This is beacause you created lv with zero size & then extended it. The single command to achive this would mention the mirror copies in the command lvcreate itself alongwith strict allocation for different copies of LE's going to indivisual disk.

This command with these options should look like.

#lvcreate -n lv_foo -s y -m 1 -L 32786 /dev/vg_foo

This will create mirroed LV of 32768 MB with name lv_foo in VG with name vg_foo on your system. For this command to complete your VG_foo should have atleast two physical volumes with 32768 MB free space of both of them. As we mentioned strict allocation, both copies of the lvol will be on seperate disks, & if one of the disk do not have free space equal to or more than 32768 MB it will give error.

HTH,
Devender
Impossible itself mentions "I m possible"
Jay Kidambi
Advisor

Re: Avoiding mirror synchronization on new LV creation

Thanks.