Introduction:
LVM (Logical Volume Manager) is a powerful storage management solution for Linux systems that allows administrators to manage disk space more flexibly by abstracting physical storage devices into logical volumes. Here's an overview of some common LVM commands and their usage:
lvmdiskscan: This command scans all disks visible to the system and provides information about them, including the device name, size, and type of partition table. It's useful for identifying available disks to be used with LVM.
lvmdiskscan
pvcreate: This command initializes physical volumes (disks or partitions) to be used by LVM.
pvcreate /dev/sdb1
vgcreate: This command creates a volume group, which is a collection of physical volumes. Volume groups are used as a pool of storage from which logical volumes are created.
vgcreate myvg /dev/sdb1
lvcreate: This command creates logical volumes within a volume group. Logical volumes are like partitions but with more flexibility in terms of resizing and management.
lvcreate -n mylv -L 10G myvg
pvs: This command displays information about physical volumes, including their size, free space, and volume group membership.
pvs
vgs: This command displays information about volume groups, including their size, free space, and associated physical volumes.
vgs
lvs: This command displays information about logical volumes, including their size, associated volume group, and mount point (if applicable).
lvs
These commands provide the basic building blocks for managing and configuring LVM storage. With LVM, administrators can dynamically resize logical volumes, add or remove physical volumes from volume groups, and perform various other storage management tasks without downtime.