set, the logical extents are stripped and mirrored to obtain the data layout displayed in
Figure 6
(page 157)
.
Striping and mirroring in LVM combines the advantages of the hardware implementation of RAID
1+0 and RAID 0+1, and provides the following benefits:
•
Better write performance. Write operations take place in parallel and each physical write
operation is directed to a different physical volume.
•
Excellent performance for read. Even in the case where several disks are out of service, the
read of a stripe can be done in parallel on different physical volumes with one I/O operation
per physical volume.
•
High availability of data. With multiple copies of the user data residing on different physical
volumes, LVM avoids single point of failure ensuring high availability.
LVM Striped and Mirrored Logical Volume Configuration
You can create a new striped and mirrored logical volume from scratch, or extend (add mirror to)
an existing striped logical volume. With the use of physical volume groups (PVGs), mirroring and
striping can be directed to specific physical volumes. Without the constraint created by the nesting
of levels in hardware based RAID solutions, LVM is combining the striping and mirroring processing,
which allows LVM to provide the best of both RAID 10 and RAID 01.
To create a pure RAID 10, ensure that the physical volumes have enough extents in terms of size
and stripe width to accommodate the logical volume. Otherwise, LVM optimizes the extent allocation
to enable you to create a striped and mirrored logical volume as long as there are enough free
extents in the volume group. The logical volume layout then uses a slight variation of RAID 10 and
all the benefits of RAID 10 are retained. For example,
Figure 7
shows a volume group with seven
physical volumes and a logical volume striped across three disks with one mirror copy.
Figure 7 Example of LVM's Implementation of Raid 10 Variation
If the first physical volume used in the creation has enough extents (size of LV/3) to create RAID
10, only six physical volumes are used, resulting in a strict RAID 1 0 configuration. But if one of
the physical volumes, for example PV0, does not have enough free extents, LVM uses another
physical volume, PV1, to complete the operation. PV0 was short by two extents so two extents
were allocated from PV1. LVM created the logical volume using seven physical volumes resulting
in a slight variation of RAID 10.
You can extend your existing striped logical volumes to a striped and mirrored configuration easily,
using the
lvextend
command to add mirrors. You cannot convert existing mirrored logical volumes
to a striped and mirrored configuration. You can create any new logical volumes with striped and
mirrored configuration as shown in
“Examples” (page 158)
.
Examples
Use any of the following procedures to create a striped and mirrored logical volume:
•
To create a logical volume of size 90MB striped across two physical volumes with one mirror
copy and stripe size of 64 KB, enter:
#lvcreate -L 90 -i 2 -I 64 -m 1 /dev/vgtest
158
Striped and Mirrored Logical Volumes