Operating System - HP-UX
1753555 Members
5550 Online
108796 Solutions
New Discussion юеВ

Re: mirroring LV from multiple PVs to multiple PVs (?)

 
SOLVED
Go to solution
Lonny Balderston
Frequent Advisor

mirroring LV from multiple PVs to multiple PVs (?)

Greetings.

I have an existing virtual array (in a HP 5470) which is to be replaced by a second virtual array (now physically installed). The way we intend to move the data from the existing array to the new array is to mirror the existing LVs to PVs on the new array. However, I am confused about how to accomplish this.

Here's the problem:

For example, LV "lvrams'" PVs on the existing array:

# lvdisplay -v /dev/vgrams/lvrams | grep "/dev/dsk" | head
/dev/dsk/c4t1d2 2559 2559
/dev/dsk/c4t1d3 2559 2559
/dev/dsk/c4t1d4 2559 2559
/dev/dsk/c4t1d5 2559 2559
/dev/dsk/c4t1d6 2559 2559
/dev/dsk/c4t1d7 2205 2205

So we would mirror lvrams onto the new array's corresponding PVs, let's say, for
example, that they are c7t1d2-c7t1d7. So the mirror commands would be:

lvextend -m 1 /dev/vgrams/lvrams /dev/dsk/c7t1d2
lvextend -m 1 /dev/vgrams/lvrams /dev/dsk/c7t1d3
lvextend -m 1 /dev/vgrams/lvrams /dev/dsk/c7t1d4
lvextend -m 1 /dev/vgrams/lvrams /dev/dsk/c7t1d5
lvextend -m 1 /dev/vgrams/lvrams /dev/dsk/c7t1d6
lvextend -m 1 /dev/vgrams/lvrams /dev/dsk/c7t1d7

But is LVM going to understand this? Or will LVM fail after the first command due
to insufficient space? (attempting to mirror the entire LV on the first PV).

Thank you.
5 REPLIES 5
erics_1
Honored Contributor
Solution

Re: mirroring LV from multiple PVs to multiple PVs (?)

Mahlon,

We mirror the logical volume itself. Simply pvcreate the new disks and vgextend them into the volume group. After that, just create the mirror:

lvextend -m 1 /dev/vgrams/lvrams

lvm will auto-select the disks based on their order in the lvmtab and availability. Likewise, you can specify which disks you'd like to mirror TO with lvextend:

lvextend -m 1 /dev/vgrams/lvrams /dev/dsk/c7t1d2 /dev/dsk/c7t1d3 ...

Regards,
Eric
James R. Ferguson
Acclaimed Contributor

Re: mirroring LV from multiple PVs to multiple PVs (?)

Hi Mahlon:

You should specify all the target physical devices in one 'lvextend -m 1' operation; e.g.:

# lvextend -m 1 /dev/vgrams/lvrams /dev/dsk/c7t1d2 /dev/dsk/c7t1d3 ...

See the manpages for 'lvextend' and thos for 'lvmpvg(4)'.

Regards!

...JRF...
Tom Danzig
Honored Contributor

Re: mirroring LV from multiple PVs to multiple PVs (?)

The first one would fail as you say due to insufficient space. You could do:

lvextend -m 1 /dev/vgrams/lvrams /dev/dsk/c7t1d2 /dev/dsk/c7t1d3 /dev/dsk/c7t1d4 /dev/dsk/c7t1d5 /dev/dsk/c7t1d6 /dev/dsk/c7t1d7

That should work assuming the new devices are the same size as the old ones and are already in the volume group.

Alternately, you could add one device at a time into the volume group and use pvmove to move the data off the old device and onto the new one, then vgreduce the old device out. This is useful if you cannot add more the one or two new devices into the existing volume group due to Max PV constraints.

Good luck!
Patrick Wallek
Honored Contributor

Re: mirroring LV from multiple PVs to multiple PVs (?)

If you want to make your life even easier, you can make use of PVGs (Physical Volume Groups)in this instance.

To create a PVG edit the /etc/lvmpvg file and add the following:

VG /dev/vgrams
PVG lvrams1
/dev/dsk/c4t1d2
/dev/dsk/c4t1d3
/dev/dsk/c4t1d4
/dev/dsk/c4t1d5
/dev/dsk/c4t1d6
/dev/dsk/c4t1d7
PVG lvrams2
/dev/dsk/c7t1d2
/dev/dsk/c7t1d3
/dev/dsk/c7t1d4
/dev/dsk/c7t1d5
/dev/dsk/c7t1d6
/dev/dsk/c7t1d7

Save the file and exit vi.

Now when you mirror you can mirror strictly between PVGs. First you will have to set the PVG-strict allocation policy for the mirrors.

# lvchange -s g /dev/vgrams/lvrams

Now you can mirror, and not worry about specifying specific disk devices.

# lvextend -m 1 /dev/vgrams/lvrams

For more information on PVGs, have a look at the lvmpvg man page and also the lvcreate man page.

Lonny Balderston
Frequent Advisor

Re: mirroring LV from multiple PVs to multiple PVs (?)

Thank you!