Installation guide

Chapter 4. LVM Administration with CLI Commands
34
You can specify which extents of a physical volume are to be used for a logical volume. The following
example creates a linear logical volume out of extents 0 through 24 of physical volume /dev/sda1
and extents 50 through 124 of physical volume /dev/sdb1 in volume group testvg.
# lvcreate -l 100 -n testlv testvg /dev/sda1:0-24 /dev/sdb1:50-124
The following example creates a linear logical volume out of extents 0 through 25 of physical volume /
dev/sda1 and then continues laying out the logical volume at extent 100.
# lvcreate -l 100 -n testlv testvg /dev/sda1:0-25:100-
The default policy for how the extents of a logical volume are allocated is inherit, which applies the
same policy as for the volume group. These policies can be changed using the lvchange command.
For information on allocation policies, see Section 4.3.1, “Creating Volume Groups”.
4.4.2. Creating Striped Volumes
For large sequential reads and writes, creating a striped logical volume can improve the efficiency
of the data I/O. For general information about striped volumes, see Section 2.3.2, “Striped Logical
Volumes”.
When you create a striped logical volume, you specify the number of stripes with the -i argument of
the lvcreate command. This determines over how many physical volumes the logical volume will be
striped. The number of stripes cannot be greater than the number of physical volumes in the volume
group (unless the --alloc anywhere argument is used).
If the underlying physical devices that make up a striped logical volume are different sizes, the
maximum size of the striped volume is determined by the smallest underlying device. For example, in
a two-legged stripe, the maximum size is twice the size of the smaller device. In a three-legged stripe,
the maximum size is three times the size of the smallest device.
The following command creates a striped logical volume across 2 physical volumes with a stripe of
64kB. The logical volume is 50 gigabytes in size, is named gfslv, and is carved out of volume group
vg0.
# lvcreate -L 50G -i2 -I64 -n gfslv vg0
As with linear volumes, you can specify the extents of the physical volume that you are using for the
stripe. The following command creates a striped volume 100 extents in size that stripes across two
physical volumes, is named stripelv and is in volume group testvg. The stripe will use sectors
0-49 of /dev/sda1 and sectors 50-99 of /dev/sdb1.
# lvcreate -l 100 -i2 -nstripelv testvg /dev/sda1:0-49 /dev/sdb1:50-99
Using default stripesize 64.00 KB
Logical volume "stripelv" created
4.4.3. Creating Mirrored Volumes