The Logical Volume Manager introduces extra layers of abstraction between the disks or storage devices presented to a Linux system and the file systems placed on them. This course explores the service and its components. This course is part of the Linux Administration Bootcamp learning path, designed to get you up and running with Linux.
- Understand what the LVM is and how it works
- Create and remove physical volumes (PVs), volume groups (VGs), and logical volumes (LVs)
- Extend volume groups and extend and mirror logical volumes
- Migrate Data from one storage device to another
- Anyone with basic knowledge of Linux who wants to learn more
- Professionals who want to learn more about Linux to enhance their career prospects
This is an intermediate-level course so some knowledge of Linux is expected. If you're just starting out, then try our Linux Fundamentals course first.
LVM stands for Logical Volume Manager. The Logical Volume Manager introduces extra layers of abstraction between the discs or storage devices presented to a Linux system and the file systems placed on those discs or storage devices. Before we get into those layers of abstraction and how to use them, let's talk about why you would want to use LVM in the first place. By the way I'm going to be teaching from slides for the next minute or two so that you understand the concepts behind LVM, and then I'm going to open up a terminal and start demonstrating exactly how to use LVM.
One benefit of using LVM is that you can create file systems that extend across multiple storage devices. With LVM, you can aggregate multiple storage devices into a single logical volume. LVM allows you to expand or shrink file systems in real time, while the data remains online and fully accessible. Without LVM, you would have to re-format and re-partition the underlying storage devices. Of course, you would have to take the file system offline to perform that work. With LVM, you eliminate that problem.
LVM also allows you to easily migrate data from one storage device to another while that data is online. For example, if you want to deploy newer, faster or more resilient storage, you can just move your existing data from the current storage devices to the new ones while your system is still active. Instead of using abstract disc numbers, you can use human readable device names of your choosing. Instead of wondering what data is on /dev/sdb, you can name your data with a descriptive name. With LVM, you can stripe data across two or more disks. This can dramatically increase throughput by allowing your system to read data in parallel.
If you want to increase fault tolerance and reliability, use LVM to mirror your data so that you always have more than one copy of your data. Using LVM mirroring prevents single points of failure. And if one storage device fails your data can be accessed to via another storage device. You can then fix or replace the failed storage device to restore your mirror all without downtime. LVM gives you the ability to create point in time snapshots of your file systems. This can be perfect for when you need consistent backups. For example, you could pause rights to a database, take a snapshot of the logical volume where that database data resides, then resume rights to that database. That way you ensure your data is in a known good state when you perform the backup of that snapshot.
Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Amazon.com. Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.