LVM and VxVM
Showing results for 
Search instead for 
Did you mean: 

Mirroring a lv which have multiple Pvs

Pramod M
Regular Advisor

Mirroring a lv which have multiple Pvs

Hi Experts,


W ehave one rx3600 server (HP-UX11iv2) with sas controller (HP  PCI/PCI-X SAS MPT Adapter). It supports only two raid volumes (RAID1). We have 8 disks. Out of these 4 disks are configured as two raid1 IR volumes. Now the rest 4 disks are to be used without IR volumes. So I need to use Mirror-Ux from OS level.


How can I create a mirror a lv which have two physical volumes?

I have a volume group of 600Gb with 2*300Gb physical disks and a lv of size 600Gb. Now how can I mirror this lv by extending this vg with 2 more 300Gb disks. Can I specify multiple PV names with the lvextend command?


VGxx is created with PV1 & PV2. Then lvolYY is created with using comple vgsize. VGxx is extended with PV3 & PV4. 

lvextend -m 1 /dev/vgXX/lvolYY /dev/disk/new_1_pv3  /dev/disk/new_1_pv4


Whether this will work? Or Can I use the lvextend command without specifying the PV paths?


Hope I will get a solution..


Thanks in advance ..


Honored Contributor

Re: Mirroring a lv which have multiple Pvs

The SYNOPSIS part of "man lvextend" says:

/usr/sbin/lvextend [-A autobackup] {-l le_number | -L lv_size | -m 
  mirror_copies} lv_path [pv_path ... | pvg_name ...]


The three dots after the pv_path means you can specify more than one PV if necessary.


So, yes, this command of yours should be OK:

> lvextend -m 1 /dev/vgXX/lvolYY /dev/disk/new_1_pv3  /dev/disk/new_1_pv4




>Or Can I use the lvextend command without specifying the PV paths?


In the SYNOPSIS, the pv_path or the pvg_name are listed within [square brackets], which means they are optional.

So yes, you can use the command without specifying any PV paths at all. In that case, the mirror extents are placed on the PVs belonging to the same VG according to the allocation policy configured for the LV. The default allocation policy is "strict": the mirrors of each logical extent must be on different PVs, but allocation is otherwise unresticted.


Another useful allocation policy is "PVG-strict": you can create the /etc/lvmpvg file to define physical volume groups within a VG, and then use the "lvchange -s g /dev/vgXX/lvolY" command to switch the LV allocation policy to PVG-strict. When mirroring a PVG-strict LV, the extent allocator checks which PVG each extent is in, and places the mirror copy to another PVG. In other words, if you set up 2 PVGs for your volume group, you are effectively enforcing a rule: "this group of PVs (PVG A) must be mirrored to that other group of disks (PVG B)".