Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Red Hat Enterprise Linux 9 Essentials Book now available.

Purchase a copy of Red Hat Enterprise Linux 9 (RHEL 9) Essentials

Red Hat Enterprise Linux 9 Essentials Print and eBook (PDF) editions contain 34 chapters and 298 pages

Preview Book

Chapter 4. LVM Administration with CLI Commands

4.1. Using CLI Commands
4.2. Physical Volume Administration
4.2.1. Creating Physical Volumes
4.2.2. Displaying Physical Volumes
4.2.3. Preventing Allocation on a Physical Volume
4.2.4. Resizing a Physical Volume
4.2.5. Removing Physical Volumes
4.3. Volume Group Administration
4.3.1. Creating Volume Groups
4.3.2. Creating Volume Groups in a Cluster
4.3.3. Adding Physical Volumes to a Volume Group
4.3.4. Displaying Volume Groups
4.3.5. Scanning Disks for Volume Groups to Build the Cache File
4.3.6. Removing Physical Volumes from a Volume Group
4.3.7. Changing the Parameters of a Volume Group
4.3.8. Activating and Deactivating Volume Groups
4.3.9. Removing Volume Groups
4.3.10. Splitting a Volume Group
4.3.11. Combining Volume Groups
4.3.12. Backing Up Volume Group Metadata
4.3.13. Renaming a Volume Group
4.3.14. Moving a Volume Group to Another System
4.3.15. Recreating a Volume Group Directory
4.4. Logical Volume Administration
4.4.1. Creating Linear Logical Volumes
4.4.2. Creating Striped Volumes
4.4.3. Creating Mirrored Volumes
4.4.4. Creating Snapshot Volumes
4.4.5. Merging Snapshot Volumes
4.4.6. Persistent Device Numbers
4.4.7. Resizing Logical Volumes
4.4.8. Changing the Parameters of a Logical Volume Group
4.4.9. Renaming Logical Volumes
4.4.10. Removing Logical Volumes
4.4.11. Displaying Logical Volumes
4.4.12. Growing Logical Volumes
4.4.13. Extending a Striped Volume
4.4.14. Shrinking Logical Volumes
4.5. Controlling LVM Device Scans with Filters
4.6. Online Data Relocation
4.7. Activating Logical Volumes on Individual Nodes in a Cluster
4.8. Customized Reporting for LVM
4.8.1. Format Control
4.8.2. Object Selection
4.8.3. Sorting LVM Reports
4.8.4. Specifying Units
This chapter summarizes the individual administrative tasks you can perform with the LVM Command Line Interface (CLI) commands to create and maintain logical volumes.

Note

If you are creating or modifying an LVM volume for a clustered environment, you must ensure that you are running the clvmd daemon. For information, see see Section 3.1, “Creating LVM Volumes in a Cluster”.

4.1. Using CLI Commands

There are several general features of all LVM CLI commands.
When sizes are required in a command line argument, units can always be specified explicitly. If you do not specify a unit, then a default is assumed, usually KB or MB. LVM CLI commands do not accept fractions.
When specifying units in a command line argument, LVM is case-insensitive; specifying M or m is equivalent, for example, and powers of 2 (multiples of 1024) are used. However, when specifying the --units argument in a command, lower-case indicates that units are in multiples of 1024 while upper-case indicates that units are in multiples of 1000.
Where commands take volume group or logical volume names as arguments, the full path name is optional. A logical volume called lvol0 in a volume group called vg0 can be specified as vg0/lvol0. Where a list of volume groups is required but is left empty, a list of all volume groups will be substituted. Where a list of logical volumes is required but a volume group is given, a list of all the logical volumes in that volume group will be substituted. For example, the lvdisplay vg0 command will display all the logical volumes in volume group vg0.
All LVM commands accept a -v argument, which can be entered multiple times to increase the output verbosity. For example, the following examples shows the default output of the lvcreate command.
# lvcreate -L 50MB new_vg
  Rounding up size to full physical extent 52.00 MB
  Logical volume "lvol0" created
The following command shows the output of the lvcreate command with the -v argument.
# lvcreate -v -L 50MB new_vg
    Finding volume group "new_vg"
  Rounding up size to full physical extent 52.00 MB
    Archiving volume group "new_vg" metadata (seqno 4).
    Creating logical volume lvol0
    Creating volume group backup "/etc/lvm/backup/new_vg" (seqno 5).
    Found volume group "new_vg"
    Creating new_vg-lvol0
    Loading new_vg-lvol0 table
    Resuming new_vg-lvol0 (253:2)
    Clearing start of logical volume "lvol0"
    Creating volume group backup "/etc/lvm/backup/new_vg" (seqno 5).
  Logical volume "lvol0" created
You could also have used the -vv, -vvv or the -vvvv argument to display increasingly more details about the command execution. The -vvvv argument provides the maximum amount of information at this time. The following example shows only the first few lines of output for the lvcreate command with the -vvvv argument specified.
# lvcreate -vvvv -L 50MB new_vg
#lvmcmdline.c:913         Processing: lvcreate -vvvv -L 50MB new_vg
#lvmcmdline.c:916         O_DIRECT will be used
#config/config.c:864       Setting global/locking_type to 1
#locking/locking.c:138       File-based locking selected.
#config/config.c:841       Setting global/locking_dir to /var/lock/lvm
#activate/activate.c:358       Getting target version for linear
#ioctl/libdm-iface.c:1569         dm version   OF   [16384]
#ioctl/libdm-iface.c:1569         dm versions   OF   [16384]
#activate/activate.c:358       Getting target version for striped
#ioctl/libdm-iface.c:1569         dm versions   OF   [16384]
#config/config.c:864       Setting activation/mirror_region_size to 512
...
You can display help for any of the LVM CLI commands with the --help argument of the command.
commandname --help
To display the man page for a command, execute the man command:
man commandname
The man lvm command provides general online information about LVM.
All LVM objects are referenced internally by a UUID, which is assigned when you create the object. This can be useful in a situation where you remove a physical volume called /dev/sdf which is part of a volume group and, when you plug it back in, you find that it is now /dev/sdk. LVM will still find the physical volume because it identifies the physical volume by its UUID and not its device name. For information on specifying the UUID of a physical volume when creating a physical volume, see see Section 6.4, “Recovering Physical Volume Metadata”.

 
 
  Published under the terms of the Creative Commons License Design by Interspire