Red Hat ENTERPRISE LINUX 5.1 - LVM ADMINISTRATION Manual page 40

Table of Contents

Advertisement

Chapter 4. LVM Administration with CLI Commands
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
4.4.1.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
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).
The stripe size should be tuned to a power of 2 between 4kB and 512kB, and matched to the
application's I/O that is using the striped volume. The -I argument of the lvcreate command
specifies the stripe size in kilobytes.
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 stride 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-50 of /dev/sda1 and sectors 50-100 of /dev/sdb1.
# lvcreate -l 100 -i2 -nstripelv testvg /dev/sda1:0-50 /dev/sdb1:50-100
Using default stripesize 64.00 KB
Logical volume "stripelv" created
4.4.1.3. Creating Mirrored Volumes
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
28
Section 4.3.1, "Creating Volume
Groups".
Section 2.3.2, "Striped Logical

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 5.1 cluster logical volume manager

Table of Contents