following example creates a linear logical volume out of extents 0 through 25 of physical volume
/dev/sda1
and extents 50 through 125 of physical volume
/dev/sdb1
in volume group
testvg
.
lvcreate -l 100 -n testlv testvg /dev/sda1:0-25 /dev/sdb1:50-125
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 3.1, “Creating Volume
Groups”
.
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
Section 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).
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
Creating Logical Volumes
35
Summary of Contents for GLOBAL FILE SYSTEM 5.0
Page 1: ...LVM Administrator s Guide Configuration and Administration 5 0 ISBN N A Publication date...
Page 4: ...LVM Administrator s Guide...
Page 8: ...viii...
Page 18: ...6...
Page 28: ...16...
Page 32: ...20...
Page 80: ...68...
Page 90: ...78...
Page 92: ...80...
Page 94: ...82...
Page 112: ...100...