Linux LVM Explained
Page content

What is LVM?

LVM - logical volume manager – is a software tool for managing disk drives, particularly larger devices in Linux.

Disks can be copied and backups can be made quickly and easily. Most notably storage devices can be hot-swapped using LVM, and partitions can be easily resized within the confines of the physical disk drives.

In addition, using Linux LVM will afford a generally more reliable and consistent use of your storage devices, resulting in faster read/write times. While LVM can be used on a home desktop Linux distro, it is mainly intended for large disk farms used as part of an enterprise server solution.

(Note that the term LVM can also apply to Logical Volume Management, a system available in HP-UX, IBM-AIX and OS/2. This article looks at the logical volume manager for Linux.)

What is Hot-Swapping?

If your PC or server reports a fault to a hard disk drive, the traditional way around this is to power everything down and remove the device, replacing it with a similar hard disk.

With hot-swapping you can replace hard disk drives while the PC or server is still running, minimising interruption for yourself or your users.

Logical volume manager stores a metadata header in each physical volume detailing the directory structure of the logical volume. This makes it easy to replace disks, and allows LVM to be used in a similar manner to RAID 1 (and to a lesser extent, RAID 0). Note that LVM is not a Linux replacement for RAID, however – the multiple disk subsystem is provided for this.

Key Advantages of LVM

LVM is available in all Linux distros at the point of installation and is considered pretty much vital by the Linux community.

While there are some RAID-esque advantages and the wonder of hot-swapping to be gained from using LVM, the real advantage is one that seems quite minor but in fact has a considerable impact on how you use your computer.

Basically, LVM’s ability to allow you to resize hard disk partitions means that you should never run out of hard disk space again. Additionally, LVM will also allow you to have many volumes on a single physical disk, more than the 15 allowed in most Linux distros.

How Do I Start Using Linux LVM?

LVM is available for all current Linux distributions and can be implemented after the OS has been fully installed, either via the GUI or the command line.

Whichever way you choose, you will first need to download the package either via the Terminal or via the Synaptic Package Manager. To download via the Terminal, use:

sudo apt-get install lvm2 system-config-lvm

Meanwhile, to find LVM in Synaptic, search for LVM – you will need to mark for installation the packages labelled lvm2 and system-config-lvm. Click Apply to confirm download and the LVM software will be installed.