Logical Volume Manager (LVM) versus standard partitioning in Linux

Use this guide to integrate the flexibility, scalability, and increased features of LVM into your server storage strategies. Traditional partitioning is good, but LVM is better.

Server storage capacity has been managed via disk drive sizes and partition configurations for decades. Clearly, those strategies work well and are reliable. However, there are many benefits to rethinking storage management on local servers. This article compares standard storage management and partitioning to Logical Volume Manager (LVM). It also demonstrates some basic commands for each approach.

Traditional storage management

I use the phrase traditional storage management to describe the process of partitioning, formatting, and mounting storage capacity from a basic hard disk drive. I contrast this standard partitioning with an alternative method called Logical Volume Manager, or LVM.

Storage space is typically managed based on the maximum capacity of individual hard disk drives. The result is that when a sysadmin thinks about storage, they do so based on each drive. For example, if a server has three hard disk drives of 1 TB each, the sysadmin considers the storage literally, I have three 1 TB drives to work with.

Three 1 TB hard drives with partitions and mount points. The partitions are entirely contained on the individual hard disk drives.

Let's very quickly review traditional storage management. Here is a sample scenario:

1. Install a new hard disk drive

Purchase a one terabyte (1 TB) hard disk drive, and then physically install it into the server.

2. Partition the drive

Use fdisk or gparted to create one or more partitions. It's important to note that the partitions cannot consume more than the total 1 TB of disk capacity.

Example fdisk command:

# fdisk /dev/sdb

I won't cover the syntax for fdisk in this article, but assume I created a single partition that consumes the entire 1 TB disk. The partition is /dev/sdb1.

Display the capacity by using the /proc/partitions and lsblk content:

# cat /proc/partitions
# lsblk

3. Create a filesystem

Create a filesystem on the new partition by using the mkfs command. You could use ext4 or RHEL's default XFS filesystem.

# mkfs.ext4 /dev/sdb1

While XFS is Red Hat's default, it may not be as flexible when combined with LVM as ext4XFS filesystems can easily be extended but not reduced. I'll expand on that idea further toward the end of the article.

4. Create a mount point

The rest of this process is relatively standard. First, create a directory to serve as a mount point. Next, manually mount the partition to the mount point.

# mkdir /newstorage
# mount /dev/sdb1 /newstorage

5. Confirm the storage capacity

Use the du command to confirm the storage space is accessible and of the expected size.

# du -h /newstorage

 

 

  • 0 Kasutajad peavad seda kasulikuks
Kas see vastus oli kasulik?

Seotud artiklid

How to back up and restore file permissions on Linux

Question: I want to back up the file permissions of the local filesystem, so that if I...

Creating logical volumes in Linux with LVM

In this third LVM article, you'll learn how to create and use a logical volume which is the final...