In this lesson, you will learn how to abstract raw physical storage into flexible logical volumes to make resizing your disk partitions effortless.
Breaking Free from Rigid Partitions
When you install Linux, you typically carve a disk into fixed-size partitions. If you realize later that your /home directory is full while /var has 500GB of empty space, you are usually stuck; shrinking one partition and expanding another is a dangerous, manual task that often requires unmounting filesystems.
Logical Volume Management (LVM) solves this by placing an abstraction layer between your physical hardware and your filesystems. Instead of assigning a filesystem directly to a partition, you treat your disks as a "pool" of storage.
The LVM Stack
LVM operates in three distinct layers:
- Physical Volumes (PVs): These are your actual raw disks or partitions (e.g.,
/dev/sda1). You initialize them to be managed by LVM. - Volume Groups (VGs): You combine one or more PVs into a single storage pool called a Volume Group. Think of this as a large "bucket" of space.
- Logical Volumes (LVs): You carve this bucket into virtual partitions called Logical Volumes. These behave exactly like standard partitions, but they are dynamic.
If you run out of space on an LV, you don't need to re-partition your physical drives. You simply add a new disk as a PV, extend your VG to include that disk, and then resize your LV.
# Initialize a disk as a Physical Volume
pvcreate /dev/sdb1
# Create a Volume Group named 'data_vg' using that PV
vgcreate data_vg /dev/sdb1
# Create a 50GB Logical Volume named 'user_data' from the VG
lvcreate -L 50G -n user_data data_vg
Because these LVs are abstracted, you can grow them on the fly—even while the system is running—without worrying about the physical layout of the underlying disks. This turns storage management from a "measure twice, cut once" manual labor into a dynamic, administrative service.
Key Takeaway: LVM transforms rigid physical disks into a flexible storage pool, allowing you to resize volumes dynamically without the risks associated with manual partition table manipulation.