Logical Volume Management(LVM)
Abstractsphysical storage, enabling the creation of flexible logical
volumes
Purpose: Simplify storage
management by allowing easy
resizing and allocation of disk
space
Source: 1.3. LVM Architecture Overview | Red Hat Product Documentation
3.
● Physical Volumes(PVs): Actual disks or partitions
● Volume Groups (VGs): Collection of physical volumes
combined into a single storage pool which can be managed
together
● Logical Volumes (LVs): Virtual partitions created from the
volume group which are used by the operating system
Components of LVM
Add Disk andCreate LVM Partition
Pre-requisite: Create a partition on a disk before following these commands
Step 1: Change the partition type from ‘Linux’ to ‘Linux LVM’ just after partition
is created
● Command: t ‘8e’
Note: (‘8e’ is hex code associated with LVM)
6.
Step 2: Installthe 'lvm2' package on the machine
● Command: yum install lvm2
Step 3: Create the physical volume
● Command: pvcreate <partition-name>
7.
Step 4: Createthe volume group
● Command: vgcreate <volume-group-name> <partition-name>
Step 6: Formatthis disk and assign file system to it
● Command: mkfs.xfs <logical-volume-path>
Step 7: Mount this disk to a drive
● Command: mount <logical-volume-path> <directory-name>
10.
Extend existing diskusing LVM
Pre-requisite: Create another disk partition (type: linux > linux LVM)
Extend existing volume group to new partition
● Command: vgextend <existing-volume-group> <partition-name>
11.
Extend the logicalvolume
● Command: lvextend-L+<size-to-extend> <logical-volume-path>
Extend the file system
● Command: xfs_growfs <logical-volume-path>