Mirror Pools: Understanding Mirror Pool Strictness

The use of mirror pools simplifies the correct mirroring of logical volumes between physical volumes from different data centers. For the greatest possible redundancy and failure safety, care should be taken when mirroring, that all physical volumes of a mirror copy come from the same data center. This can be achieved very easily with mirror pools. In the following, the meaning of the mirror pool strictness will be examined in more detail; it can be set to one of the values ‘n‘ (no), ‘y‘ (yes) or ‘s‘ (super-strict) for each volume group.

1. Our Test Environment

In our test environment we created a scalable volume group with 4 physical volumes:

$  lsvg -p datavg01
datavg01:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk4            active            39          39          08..08..07..08..08
hdisk5            active            39          39          08..08..07..08..08
hdisk8            active            39          39          08..08..07..08..08
hdisk9            active            39          39          08..08..07..08..08
$

The 4 physical volumes come from 2 different data centers, hdisk4 and hdisk5 come from the data center DC1 and hdisk8 and hdisk9 come from the data center DC2. No mirror pools have yet been defined.

2. Mirror Pool Strictnessno

Mirror pools can be used, but do not have to be used. We create the mirror pool DC1 with hdisk4 and hdisk5 and the mirror pool DC2 with hdisk8 and hdisk9:

# chpv -p DC1 hdisk4
# chpv -p DC1 hdisk5
# chpv -p DC2 hdisk8
# chpv -p DC2 hdisk9
#

First we create a mirrored LV without specifying mirror pools:

# mklv -c 2 -t jfs2 datavg01 10
fslv00
#

As expected, the physical volumes hdisk4 and hdisk5 are used for the two mirror copies, which means that both copies are in the same data center:

$ lslv -m fslv00
fslv00:N/A
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0009 hdisk4            0009 hdisk5
0002  0010 hdisk4            0010 hdisk5
0003  0011 hdisk4            0011 hdisk5
0004  0012 hdisk4            0012 hdisk5
0005  0013 hdisk4            0013 hdisk5
0006  0014 hdisk4            0014 hdisk5
0007  0015 hdisk4            0015 hdisk5
0008  0016 hdisk4            0016 hdisk5
0009  0017 hdisk4            0017 hdisk5
0010  0018 hdisk4            0018 hdisk5
$

The fact that the physical volumes are assigned to a mirror pool does not matter if the LV is created without specifying mirror pools. All physical volumes are potential candidates, regardless of whether they belong to a mirror pool or not.

Since the use of mirror pools is optional with Mirror Pool Strictness set to ‘no‘, it is possible to create a mirrored LV, in which one copy is in one of the mirror pools, but the second copy is not assigned to a mirror pool:

# mklv -c 2 -t jfs2 -p copy1=DC1 datavg01 10
fslv01
#

This does not make much sense, but is nevertheless possible. In this specific case, the second copy happens to be in the second mirror pool. That depends on the allocation policies and the current space conditions on the physical volumes:

$ lslv -m fslv01
fslv01:/test
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0019 hdisk4            0009 hdisk8
0002  0020 hdisk4            0010 hdisk8
0003  0021 hdisk4            0011 hdisk8
0004  0022 hdisk4            0012 hdisk8
0005  0023 hdisk4            0013 hdisk8
0006  0024 hdisk4            0014 hdisk8
0007  0025 hdisk4            0015 hdisk8
0008  0026 hdisk4            0016 hdisk8
0009  0027 hdisk4            0017 hdisk8
0010  0028 hdisk4            0018 hdisk8
$

In a further experiment, we create a mirrored LV in which both mirror copies are assigned to the same mirror pool:

# mklv -c 2 -t jfs2 -p copy1=DC1 -p copy2=DC1 datavg01 10
fslv02
#

This is easily possible if the mirror pool has 2 different physical volumes with sufficient space. The LV has the LV Strictnessyes‘ by default, which means the use of at least 2 physical volumes.

$ lslv -m fslv02
fslv02:N/A
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0019 hdisk5            0029 hdisk4
0002  0020 hdisk5            0030 hdisk4
0003  0021 hdisk5            0031 hdisk4
0004  0022 hdisk5            0032 hdisk4
0005  0023 hdisk5            0033 hdisk4
0006  0024 hdisk5            0034 hdisk4
0007  0025 hdisk5            0035 hdisk4
0008  0026 hdisk5            0036 hdisk4
0009  0027 hdisk5            0037 hdisk4
0010  0028 hdisk5            0038 hdisk4
$

Of course, you can also create a LV with mirror copies in two different mirror pools, which should be the most meaningful option in most cases:

# mklv -c 2 -t jfs2 -p copy1=DC1 -p copy2=DC2 datavg01 10
fslv03
#
$ lslv -m fslv03
fslv03:N/A
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0029 hdisk5            0009 hdisk9
0002  0030 hdisk5            0010 hdisk9
0003  0031 hdisk5            0011 hdisk9
0004  0032 hdisk5            0012 hdisk9
0005  0033 hdisk5            0013 hdisk9
0006  0034 hdisk5            0014 hdisk9
0007  0035 hdisk5            0015 hdisk9
0008  0036 hdisk5            0016 hdisk9
0009  0037 hdisk5            0017 hdisk9
0010  0038 hdisk5            0018 hdisk9
$

As the examples show, in the case of Mirror Pool Strictness set to ‘no‘ you cannot prevent an administrator from not using mirror pools at all (1st example) or only partially using mirror pools (2nd and 3rd example). Therefore, Mirror Pool Strictness set to ‘no‘ should only be used if mirror pools are not used at all.

3. Mirror Pool Strictnessyes

If you mirror pool strictness is set to ‘yes‘, mirror pools must be used.

We start by deleting all LVs and then removing the assignment of the physical volumes to the two mirror pools, which deletes the mirror pools:

# rmlv -f fslv03
rmlv: Logical volume fslv03 is removed.
# rmlv -f fslv02
rmlv: Logical volume fslv02 is removed.
# rmlv -f fslv01
rmlv: Logical volume fslv01 is removed.
# rmlv -f fslv00
rmlv: Logical volume fslv00 is removed.
# chpv -P hdisk4
# chpv -P hdisk5
# chpv -P hdisk8
# chpv -P hdisk9
#

Before we change the value for Mirror Pool Strictness, we create a mirrored LV without mirror pools. This corresponds to the case in practice in which one would like to introduce mirror pools for an existing VG:

# mklv -c 2 -t jfs2 datavg01 10
fslv00
#

The two mirror copies (not shown here) are again on hdisk4 and hdisk5.

Now we enforce the use of mirror pools by setting the mirror pool strictness for the VG to ‘yes‘:

# chvg -M y datavg01
#

Now we try to create an LV without mirror pools:

# mklv -c 2 -t jfs2 datavg01 10
0516-1814 lcreatelv: Mirror pools must be defined for each copy when strict mirror
pools are enabled.
0516-822 mklv: Unable to create logical volume.
#

This is no longer possible, as the rather clear error message shows.

We create the two mirror pools DC1 and DC2 again as above:

# chpv -p DC1 hdisk4
# chpv -p DC1 hdisk5
# chpv -p DC2 hdisk8
# chpv -p DC2 hdisk9
#

It is still possible to create a LV without mirroring; the single copy only has to be assigned to one of the mirror pools:

# mklv -t jfs2 -p copy1=DC1 datavg01 10
fslv01
#

Or you can create mirrored LVs in which several mirror copies are assigned to the same mirror pool:

# mklv -t jfs2 -p copy1=DC1 -p copy2=DC1 datavg01 10
fslv02
#

The mirror pool DC2 is not used in both examples. Mirroring within a mirror pool is possible, but generally not useful!

I.e. you have to use mirror pools for all the mirror copies of each LV, but not all of the mirror pools have to be used.

If the Mirror Pool Strictness is set to ‘yes‘, you can mirror, but you don’t have to mirror. If you need both mirrored LVs (mirrored across mirror pools, of course) and unmirrored LVs at the same time when using mirror pools, this is possible with Mirror Pool Strictness set to ‘yes‘.

4. Mirror Pool Strictnesssuper-strict

With this setting, all mirror pools must be used for each LV. The number of mirror pools indicates how many mirror copies each LV must have at least.

We start again with the configuration without LVs and without mirror pools and again create the first mirrored LV without mirror pools:

# mklv -c 2 -t jfs2 datavg01 10
fslv00
#

Then we set mirror pool strictness to ‘super-strict‘:

# chvg -M s datavg01
#

As in the previous case, LVs can only be created by specifying mirror pools. Therefore we create the same mirror pools as above:

# chpv -p DC1 hdisk4
# chpv -p DC1 hdisk5
# chpv -p DC2 hdisk8
# chpv -p DC2 hdisk9
#

If you only have one mirror pool (does not make sense), you can only create unmirrored LVs, or you have to assign all copies to the single mirror pool when mirroring. However, this essentially corresponds to the situation without mirror pools.

If you have two mirror pools (that should be the most common configuration), it is no longer possible to create an unmirrored LV

# mklv -t jfs2 -p copy1=DC1 datavg01 10
0516-1829 mklv: Every mirror pool must contain a copy of
the logical volume.
0516-822 mklv: Unable to create logical volume.
#

In the case of two mirror pools, all LVs should have exactly 2 mirror copies, with each copy then being in a different mirror pool:

# mklv -c 2 -t jfs2 -p copy1=DC1 -p copy2=DC2 datavg01 10
fslv01
#
$ lslv -m fslv01
fslv01:/test
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0019 hdisk4            0009 hdisk8
0002  0020 hdisk4            0010 hdisk8
0003  0021 hdisk4            0011 hdisk8
0004  0022 hdisk4            0012 hdisk8
0005  0023 hdisk4            0013 hdisk8
0006  0024 hdisk4            0014 hdisk8
0007  0025 hdisk4            0015 hdisk8
0008  0026 hdisk4            0016 hdisk8
0009  0027 hdisk4            0017 hdisk8
0010  0028 hdisk4            0018 hdisk8
$

Even if it does not make sense, you can create an LV with 3 mirror copies; you only need to specify the same mirror pool for 2 of the copies:

# mklv -c 3 -t jfs2 -p copy1=DC1 -p copy2=DC2 -p copy3=DC1 datavg01 10
fslv02
#

If you have 3 mirror pools, you can only create LVs with 3 mirror copies.

More than 3 mirror pools are not possible with mirror pool strictness set to ‘super-strict‘, as the AIX LVM only supports a maximum of 3 mirror copies. Attempting to create a fourth mirror pool leads to an error message:

# chpv -p DC3 hdisk8
# chpv -p DC4 hdisk9
0516-1828 lchangepv: Maximum number of mirror pools reached.
0516-722 chpv: Unable to change physical volume hdisk9.
#

Using mirror pool strictness set to ‘super-strict‘ ensures that all LVs in a VG are mirrored across all (maximum 3) mirror pools. In other words: every mirror pool must have at least 1 copy of every LV.

The most common situation in practice is likely to be the case in which you want to enforce correct mirroring between 2 data centers. A mirror pool is then created for each data center with the physical volumes of the data center, thus ensuring that all LVs are mirrored in the VG and have at least 1 mirror copy in each of these two data centers.

See also:

Mirror Pools: An Introduction

Michael Perzl: Introduction to AIX Mirror Pools

AIX LVM: Mechanics of migratepv (Part I)

AIX LVM: Mechanics of migratepv (Part II)

AIX LVM: Mechanics of migratepv (Part III)

AIX LVM: Mechanics of migratelp