What is LVM2 in Linux ?
LVM
Logical Volume Manager (LVM) is a versatile disk management and partitioning system designed for Linux.
It introduces a high-level abstraction layer over physical storage, allowing for dynamic and flexible control of storage volumes.
LVM is especially useful in scenarios where storage requirements may evolve, such as in server environments and virtualization.
LVM2
LVM2, or Logical Volume Manager 2, is a set of tools that provide logical volume management for the Linux kernel.
LVM2 facilitates the management of disk drives and their partitions by allowing administrators to create, resize, and move logical volumes dynamically.
Functionality of LVM2
Physical Volume (PV):
A physical volume represents a storage device or partition used by LVM.
Initialization of a physical volume can be done with the pvcreate
command, for example: sudo pvcreate /dev/sdX
.
Lets see PV commnds examples.
Creating a Physical Volume:To initialize a storage device or partition as a physical volume, use the pvcreate
command.
Displaying Information about Physical Volumes:Use the pvdisplay
command to view detailed information about one or more physical volumes.
Removing a Physical Volume:If you need to remove a physical volume, you can use the pvremove
command.
Volume Group (VG):
A volume group is a collection of physical volumes.
The creation of a volume group is accomplished using the vgcreate
command. For instance: sudo vgcreate myvg /dev/sdX1 /dev/sdX2
.
Lets see VG commnds examples.
Creating a Volume Group:To create a new volume group, use the vgcreate
command.
Displaying Information about Volume Groups: Use the vgdisplay
command to view detailed information about volume groups.
Adding Physical Volumes to a Volume Group: To add additional physical volumes to an existing volume group, use the vgextend
command.
Reducing a Volume Group by Removing Physical Volumes: If you want to reduce a volume group by removing a physical volume, use the vgreduce
command.
Renaming a Volume Group: To rename a volume group, you can use the vgrename
command.
Activating a Volume Group: If a volume group is not active, you can activate it using the vgchange
command.
Deactivating a Volume Group: To deactivate a volume group, use the vgchange
command.
Removing a Volume Group: To remove a volume group, use the vgremove
command.
Logical Volume (LV):
A logical volume is a virtual partition within a volume group.
Logical volumes can be created with the lvcreate
command. An example would be: sudo lvcreate -L 10G -n mylv myvg
.
Lets see LV commnds examples.
Creating a Logical Volume: Use the lvcreate
command to create a logical volume within a volume group.
Displaying Information about Logical Volumes: The lvdisplay
command provides detailed information about logical volumes.
Resizing a Logical Volume: Extend the size of a logical volume using the lvextend
command.
Reducing the Size of a Logical Volume: To reduce the size of a logical volume, use the lvreduce
command.
Removing a Logical Volume: To remove a logical volume, use the lvremove
command.
….
Thank you !!
….
….
….
For more stuff like this follow: