LVM

From Jonathan Gardner's Tech Wiki
Jump to: navigation, search

Introduction

Linux Volume Manager (LVM) allows a single partition to span multiple partitions.

Terminology

Device
A Device is anything--virtual or physical--that can store data. Devices are usually partitioned into partitions.
Partition
A Partition is a group of bytes from a single device that is formatted into a filesystem.
Filesystem
A Filesystem is a formatted partition that can be mounted somewhere in the system filesystem tree. For instance, the /boot filesystem can be mounted at /boot in the filesystem tree.
Volume
A Volume in LVM is a collection of partitions that will be grouped together. A Volumn behaves like a Device.
Volume Group
A Volume Group in LVM is a portion of a Volume that behaves like a partition.

What LVM Does

Let's say you have a machine with three hard drives, each 100GB in size. (Hard drives are devices.) The hard drives are called:

  • /dev/sda
  • /dev/sdb
  • /dev/sdc

You've formatted your system so that:

  • /dev/sda1 is 100MG big, formatted ext2 and holds the /boot partition.
  • /dev/sda2 is 99.9GB big, spanning the entire device.
  • /dev/sdb1 is 100GB big, spanning the entire device.
  • /dev/sdc1 is 100GB big, spanning the entire device.

You'd like to put all the other three partitions together so that you can have one giant partition of roughly 300GB.

This is where LVM comes in. You create a new Volume from /dev/sda2, /dev/sdb1, and /dev/sdc1. The you can create whatever volume groups you like within that, and format then however you like, and mount them where you like.