The Uptime Engineer

👋Hi, I am Yoshik Karnawat

Don’t scroll past, this week’s 90-second read might just save you hours at work.

You’ve run out of space on your database partition.

Meanwhile, your logs partition is chilling with 80GB free.

Classic.

This is what happens when you use fixed partitions. You get locked into your install-time guesses.

Can’t move space around.

Can’t grow one partition without shrinking another.

Your options?

  • Resize partitions (risky)

  • Add new disks (messy)

  • Rebuild everything (painful)

There’s a smarter way.

It’s called LVM - Logical Volume Management.

And once you use it, you’ll never go back.

What LVM Actually Does

LVM sits between your physical disks and filesystems, like a flexibility layer for storage.

Here's the mental model:

  • Physical Volumes (PV): Your actual disks or partitions

  • Volume Groups (VG): A pool combining multiple physical volumes

  • Logical Volumes (LV): Flexible partitions you create from the pool

Instead of carving up /dev/sda into fixed partitions, you throw all your disks into a pool.

Then you create logical volumes with meaningful names like databases or logs that you can resize anytime.

Why This Matters

Your database runs out of space? Extend the logical volume. Done.

Your logs partition is too large? Shrink it and reassign that space elsewhere.

Need more capacity overall?

Add a new physical disk to the pool, and the space becomes instantly usable.

The filesystem doesn’t care. It just sees more space.

That’s true flexibility.

A Quick Example

Let's say you have two disks:

/dev/sda (200GB) and /dev/sdb (100GB).

Mark them as physical volumes:

sudo pvcreate /dev/sda /dev/sdb

Combine them into a volume group:

sudo vgcreate storage_pool /dev/sda /dev/sdb

Now you have a 300GB pool. Create logical volumes from it:

sudo lvcreate -L 50G -n databases storage_pool
sudo lvcreate -L 30G -n logs storage_pool
sudo lvcreate -l 100%FREE -n backups storage_pool

Three volumes. One command each.

The remaining space automatically goes to backups.

Format and mount them like normal partitions:

sudo mkfs.ext4 /dev/storage_pool/databases
sudo mount /dev/storage_pool/databases /mnt/databases

Why is this Powerful

Resizing: Your database outgrew 50GB? Expand it to 80GB without unmounting:

sudo lvextend -L +30G /dev/storage_pool/databases
sudo resize2fs /dev/storage_pool/databases

Adding Disks: Drop a new 500GB disk into the pool and immediately make it available to any volume. No reshuffling. No partitioning dance.

Meaningful Names: No more guessing what /dev/sda3 contains. Your volumes are called databases, www, workspace, whatever makes sense.

Takeaway

LVM decouples your storage from physical boundaries.

You stop worrying about where space lives and start thinking about how much each workload needs right now.

It’s a smarter abstraction.

It makes storage behave like code. Modular, reusable, and elastic.

Once you’ve used LVM, fixed partitions feel like programming without functions.

Keep Reading

No posts found