Creating Logical Volumes - Red Hat ENTERPRISE LINUX 5 - LOGICAL VOLUME MANAGER ADMINISTRATION Manual

Hide thumbs Also See for ENTERPRISE LINUX 5 - LOGICAL VOLUME MANAGER ADMINISTRATION:
Table of Contents

Advertisement

Creating Logical Volumes

4.4.1. Creating Logical Volumes
To create a logical volume, use the lvcreate command. You can create linear volumes, striped
volumes, and mirrored volumes, as described in the following subsections.
If you do not specify a name for the logical volume, the default name lvol# is used where # is the
internal number of the logical volume.
The following sections provide examples of logical volume creation for the three types of logical
volumes you can create with LVM.
4.4.1.1. Creating Linear Volumes
When you create a logical volume, the logical volume is carved from a volume group using the free
extents on the physical volumes that make up the volume group. Normally logical volumes use up any
space available on the underlying physical volumes on a next-free basis. Modifying the logical volume
frees and reallocates space in the physical volumes.
The following command creates a logical volume 10 gigabytes in size in the volume group vg1.
lvcreate -L 10G vg1
The following command creates a 1500 megabyte linear logical volume named testlv in the volume
group testvg, creating the block device /dev/testvg/testlv.
lvcreate -L1500 -n testlv testvg
The following command creates a 50 gigabyte logical volume named gfslv from the free extents in
volume group vg0.
lvcreate -L 50G -n gfslv vg0
You can use the -l argument of the lvcreate command to specify the size of the logical volume in
extents. You can also use this argument to specify the percentage of the volume group to use for the
logical volume. The following command creates a logical volume called mylv that uses 60% of the
total space in volume group testvol.
lvcreate -l 60%VG -n mylv testvg
You can also use the -l argument of the lvcreate command to specify the percentage of the
remaining free space in a volume group as the size of the logical volume. The following command
creates a logical volume called yourlv that uses all of the unallocated space in the volume group
testvol.
lvcreate -l 100%FREE -n yourlv testvg
31

Advertisement

Table of Contents
loading

Table of Contents