LVM - Logical Volume Management

Table of Contents

Documents

Overview

LVM stands for Logical Volume Manager. These pages describe LVM 2.

Tons of information is available in the LVM HOWTO

To display information about your LVM setup use:

  • pvscan to display physical volumes set up for LVM
  • vgscan to display volume groups defined on physical volumes
  • lvscan to display logical volumes defined in volume groups.

You create your filesystems in logical volumes.

Physical Volumes

server:# pvscan
  PV /dev/hdc3   VG VOL2   lvm2 [94.04 GB / 91.04 GB free]
  PV /dev/hda3   VG VOL1   lvm2 [94.04 GB / 94.04 GB free]
  PV /dev/md0    VG RAID   lvm2 [139.69 GB / 115.74 GB free]
  Total: 3 [327.76 GB] / in use: 3 [327.76 GB] / in no VG: 0 [0   ]
server:#

Here are 3 physical partitions:

  • /dev/hda3 for volume group VOL1
  • /dev/hdc3 for volume group VOL2
  • /dev/md0 for volume group RAID (on a RAID storage device)

Volume Groups

Physical volumes are assembled in volume groups.

Here 3 volume groups exist: RAID, VOL1, and VOL2.

server:# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "VOL2" using metadata type lvm2
  Found volume group "VOL1" using metadata type lvm2
  Found volume group "RAID" using metadata type lvm2
server:#

Logical Volumes

Logical Volumes contain your filesystems and are created in volume groups.

Here are the three volume groups shown using lvscan.

server:# lvscan
  ACTIVE            '/dev/VOL2/TMP' [3.00 GB] inherit
  ACTIVE            '/dev/RAID/HOME' [2.10 GB] inherit
  ACTIVE            '/dev/RAID/USR' [9.70 GB] inherit
  ACTIVE            '/dev/RAID/VAR' [10.00 GB] inherit
  ACTIVE            '/dev/RAID/USRLOCAL' [1.00 GB] inherit
  ACTIVE            '/dev/RAID/ROOT' [152.00 MB] inherit
  ACTIVE            '/dev/RAID/VS-SSH' [1.00 GB] inherit
server:#

Here are the logical volumes defined in the volume groups.

  • VOL1 is empty
  • VOL2 has
    • TMP for /tmp
  • RAID has
    • HOME for /home
    • USR for /usr
    • VAR for /var
    • USRLOCAL for /usr/local
    • ROOT for /
    • VS-SSH for a virtual server /var/lib/vservers/ssh

Author: Bernt Hansen