Installation guide

Creating Mirrored Volumes
35
Mirrored LVM Logical Volumes in a Cluster
Creating a mirrored LVM logical volume in a cluster requires the same commands and
procedures as creating a mirrored LVM logical volume on a single node. However, in order to
create a mirrored LVM volume in a cluster the cluster and cluster mirror infrastructure must be
running, the cluster must be quorate, and the locking type in the lvm.conf file must be set
correctly to enable cluster locking. For an example of creating a mirrored volume in a cluster, see
Section 5.5, “Creating a Mirrored LVM Logical Volume in a Cluster”.
Attempting to run multiple LVM mirror creation and conversion commands in quick succession
from multiple nodes in a cluster might cause a backlog of these commands. This might cause
some of the requested operations to time-out and, subsequently, fail. To avoid this issue, it is
recommended that cluster mirror creation commands be executed from one node of the cluster.
When you create a mirrored volume, you specify the number of copies of the data to make with the -
m argument of the lvcreate command. Specifying -m1 creates one mirror, which yields two copies
of the file system: a linear logical volume plus one copy. Similarly, specifying -m2 creates two mirrors,
yielding three copies of the file system.
The following command creates a mirrored logical volume with a single mirror. The volume is 50
gigabytes in size, is named mirrorlv, and is carved out of volume group vg0:
# lvcreate -L 50G -m1 -n mirrorlv vg0
An LVM mirror divides the device being copied into regions that, by default, are 512KB in size. You
can use the -R argument of the lvcreate command to specify the region size in megabytes. You can
also change the default region size by editing the mirror_region_size setting in the lvm.conf
file.
Note
Due to limitations in the cluster infrastructure, cluster mirrors greater than 1.5TB cannot be
created with the default region size of 512KB. Users that require larger mirrors should increase
the region size from its default to something larger. Failure to increase the region size will cause
LVM creation to hang and may hang other LVM commands as well.
As a general guideline for specifying the region size for mirrors that are larger than 1.5TB, you
could take your mirror size in terabytes and round up that number to the next power of 2, using
that number as the -R argument to the lvcreate command. For example, if your mirror size is
1.5TB, you could specify -R 2. If your mirror size is 3TB, you could specify -R 4. For a mirror
size of 5TB, you could specify -R 8.
The following command creates a mirrored logical volume with a region size of 2MB:
# lvcreate -m1 -L 2T -R 2 -n mirror vol_group