Installation guide

Creating Mirrored Volumes
37
When a mirror is created, the mirror regions are synchronized. For large mirror components, the sync
process may take a long time. When you are creating a new mirror that does not need to be revived,
you can specify the --nosync argument to indicate that an initial synchronization from the first device
is not required.
You can specify which devices to use for the mirror legs and log, and which extents of the devices to
use. To force the log onto a particular disk, specify exactly one extent on the disk on which it will be
placed. LVM does not necessary respect the order in which devices are listed in the command line. If
any physical volumes are listed that is the only space on which allocation will take place. Any physical
extents included in the list that are already allocated will get ignored.
The following command creates a mirrored logical volume with a single mirror and a single log that
is not mirrored. The volume is 500 MB in size, it is named mirrorlv, and it is carved out of volume
group vg0. The first leg of the mirror is on device /dev/sda1, the second leg of the mirror is on
device /dev/sdb1, and the mirror log is on /dev/sdc1.
# lvcreate -L 500M -m1 -n mirrorlv vg0 /dev/sda1 /dev/sdb1 /dev/sdc1
The following command creates a mirrored logical volume with a single mirror. The volume is 500 MB
in size, it is named mirrorlv, and it is carved out of volume group vg0. The first leg of the mirror is
on extents 0 through 499 of device /dev/sda1, the second leg of the mirror is on extents 0 through
499 of device /dev/sdb1, and the mirror log starts on extent 0 of device /dev/sdc1. These are 1MB
extents. If any of the specified extents have already been allocated, they will be ignored.
# lvcreate -L 500M -m1 -n mirrorlv vg0 /dev/sda1:0-499 /dev/sdb1:0-499 /dev/sdc1:0
Note
As of the Red Hat Enterprise Linux 6.1 release, you can combine RAID0 (striping) and RAID1
(mirroring) in a single logical volume. Creating a logical volume while simultaneously specifying
the number of mirrors (--mirrors X) and the number of stripes (--stripes Y) results in a
mirror device whose constituent devices are striped.
4.4.3.1. Mirrored Logical Volume Failure Policy
You can define how a mirrored logical volume behaves in the event of a device failure with the
mirror_image_fault_policy and mirror_log_fault_policy parameters in the activation
section of the lvm.conf file. When these parameters are set to remove, the system attempts to
remove the faulty device and run without it. When this parameter is set to allocate, the system
attempts to remove the faulty device and tries to allocate space on a new device to be a replacement
for the failed device; this policy acts like the remove policy if no suitable device and space can be
allocated for the replacement.
By default, the mirror_log_fault_policy parameter is set to allocate. Using this policy for the
log is fast and maintains the ability to remember the sync state through crashes and reboots. If you set
this policy to remove, when a log device fails the mirror converts to using an in-memory log and the
mirror will not remember its sync status across crashes and reboots and the entire mirror will be re-
synced.