Installation guide
Table Of Contents
- LVM Administrator's Guide
- Table of Contents
- Introduction
- Chapter 1. The LVM Logical Volume Manager
- Chapter 2. LVM Components
- Chapter 3. LVM Administration Overview
- Chapter 4. LVM Administration with CLI Commands
- 1. Using CLI Commands
- 2. Physical Volume Administration
- 3. Volume Group Administration
- 3.1. Creating Volume Groups
- 3.2. Adding Physical Volumes to a Volume Group
- 3.3. Displaying Volume Groups
- 3.4. Scanning Disks for Volume Groups to Build the Cache File
- 3.5. Removing Physical Volumes from a Volume Group
- 3.6. Changing the Parameters of a Volume Group
- 3.7. Activating and Deactivating Volume Groups
- 3.8. Removing Volume Groups
- 3.9. Splitting a Volume Group
- 3.10. Combining Volume Groups
- 3.11. Backing Up Volume Group Metadata
- 3.12. Renaming a Volume Group
- 3.13. Moving a Volume Group to Another System
- 3.14. Recreating a Volume Group Directory
- 4. Logical Volume Administration
- 4.1. Creating Logical Volumes
- 4.2. Persistent Device Numbers
- 4.3. Resizing Logical Volumes
- 4.4. Changing the Parameters of a Logical Volume Group
- 4.5. Renaming Logical Volumes
- 4.6. Removing Logical Volumes
- 4.7. Displaying Logical Volumes
- 4.8. Growing Logical Volumes
- 4.9. Extending a Striped Volume
- 4.10. Shrinking Logical Volumes
- 5. Creating Snapshot Volumes
- 6. Controlling LVM Device Scans with Filters
- 7. Online Data Relocation
- 8. Activating Logical Volumes on Individual Nodes in a Cluster
- 9. Customized Reporting for LVM
- Chapter 5. LVM Configuration Examples
- Chapter 6. LVM Troubleshooting
- Chapter 7. LVM Administration with the LVM GUI
- Appendix A. The Device Mapper
- Appendix B. The LVM Configuration Files
- Appendix C. LVM Object Tags
- Appendix D. LVM Volume Group Metadata
- Index

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 re-
maining 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
You can use -l argument of the lvcreate command to create a logical volume that uses the en-
tire volume group. Another way to create a logical volume that uses the entire volume group is
to use the vgdisplay command to find the "Total PE" size and to use those results as input to
the the lvcreate command.
The following commands create a logical volume called mylv that fills the volume group named
testvg.
# vgdisplay testvg | grep "Total PE"
Total PE 10230
# lvcreate -l 10230 testvg -n mylv
The underlying physical volumes used to create a logical volume can be important if the physic-
al volume needs to be removed, so you may need to consider this possibility when you create
the logical volume. For information on removing a physical volume from a volume group, see
Section 3.5, “Removing Physical Volumes from a Volume Group”.
To create a logical volume to be allocated from a specific physical volume in the volume group,
specify the physical volume or volumes at the end at the lvcreate command line. The following
command creates a logical volume named testlv in volume group testvg allocated from the
physical volume /dev/sdg1,
lvcreate -L 1500 -ntestlv testvg /dev/sdg1
You can specify which extents of a physical volume are to be used for a logical volume. The fol-
lowing 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.
4.1. Creating Logical Volumes
29