LVM in Linux Explained: PV, VG, LV with Example

💾 Understanding LVM in Linux (PV, VG, LV) — with a simple example If you’ve ever struggled with disk management in Linux, learning LVM (Logical Volume Manager) is a game changer. 👉 Let’s break it down: 🔹 PV (Physical Volume) This is your actual disk or partition. Example: /dev/sda1, /dev/sdb1 🔹 VG (Volume Group) Think of this as a pool of storage created by combining multiple PVs. Example: Combine /dev/sda1 + /dev/sdb1 → vg_data 🔹 LV (Logical Volume) This is the usable partition created from the VG (like a flexible partition). Example: lv_data created inside vg_data 🧠 How it works together: PV → VG → LV → Filesystem 🚀 Real Example (Commands): 1️⃣ Create Physical Volumes pvcreate /dev/sda1 /dev/sdb1 2️⃣ Create Volume Group vgcreate vg_data /dev/sda1 /dev/sdb1 3️⃣ Create Logical Volume (10GB) lvcreate -L 10G -n lv_data vg_data 4️⃣ Format and Mount mkfs.ext4 /dev/vg_data/lv_data mount /dev/vg_data/lv_data /mnt/data 🔥 Why LVM is powerful: ✔ Resize storage without downtime ✔ Combine multiple disks easily ✔ Take snapshots ✔ Flexible and scalable 💡 Example Use Case: You start with 10GB, later need 20GB → just extend LV without touching data! #Linux #DevOps #LVM #SystemAdministration #CloudComputing #TechLearning #OpenSource #Backend #Infrastructure

To view or add a comment, sign in

Explore content categories