Installation guide

Chapter 4. LVM Administration with CLI Commands
36
LVM maintains a small log which it uses to keep track of which regions are in sync with the mirror or
mirrors. By default, this log is kept on disk, which keeps it persistent across reboots and ensures that
the mirror does not need to be re-synced every time a machine reboots or crashes. You can specify
instead that this log be kept in memory with the --mirrorlog core argument; this eliminates the
need for an extra log device, but it requires that the entire mirror be resynchronized at every reboot.
The following command creates a mirrored logical volume from the volume group bigvg. The logical
volume is named ondiskmirvol and has a single mirror. The volume is 12MB in size and keeps the
mirror log in memory.
# lvcreate -L 12MB -m1 --mirrorlog core -n ondiskmirvol bigvg
Logical volume "ondiskmirvol" created
The mirror log is created on a separate device from the devices on which any of the mirror legs are
created. It is possible, however, to create the mirror log on the same device as one of the mirror
legs by using the --alloc anywhere argument of the vgcreate command. This may degrade
performance, but it allows you to create a mirror even if you have only two underlying devices.
The following command creates a mirrored logical volume with a single mirror for which the mirror
log is on the same device as one of the mirror legs. In this example, the volume group vg0 consists
of only two devices. This command creates a 500 MB volume named mirrorlv in the vg0 volume
group.
# lvcreate -L 500M -m1 -n mirrorlv -alloc anywhere vg0
Note
With clustered mirrors, the mirror log management is completely the responsibility of the cluster
node with the currently lowest cluster ID. Therefore, when the device holding the cluster mirror
log becomes unavailable on a subset of the cluster, the clustered mirror can continue operating
without any impact, as long as the cluster node with lowest ID retains access to the mirror log.
Since the mirror is undisturbed, no automatic corrective action (repair) is issued, either. When
the lowest-ID cluster node loses access to the mirror log, however, automatic action will kick in
(regardless of accessibility of the log from other nodes).
To create a mirror log that is itself mirrored, you can specify the --mirrorlog mirrored argument.
The following command creates a mirrored logical volume from the volume group bigvg. The logical
volume is named twologvol and has a single mirror. The volume is 12MB in size and the mirror log
is mirrored, with each log kept on a separate device.
# lvcreate -L 12MB -m1 --mirrorlog mirrored -n twologvol bigvg
Logical volume "twologvol" created
Just as with a standard mirror log, it is possible to create the redundant mirror logs on the same device
as the mirror legs by using the --alloc anywhere argument of the vgcreate command. This
may degrade performance, but it allows you to create a redundant mirror log even if you do not have
sufficient underlying devices for each log to be kept on a separate device than the mirror legs.