LVM

From Briki
Revision as of 13:57, 20 August 2007 by 205.228.74.11 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

  • One or more Physical Volumes (eg. /dev/sda2) are joined together in a Volume Group (eg. /dev/vg1)
  • A Volume Group is split into one or more Logical Volumes (eg. /dev/vg1/media)

Creating a new volume group & logical volume

To create a volume group (/dev/vg1) consisting of 1 physical volume (/dev/sda2), and split into only 1 logical volume (/dev/vg1/media):

  • Setup partition as a physical volume:
sudo pvcreate /dev/sda2
  • Create a volume group consisting of only this physical volume:
sudo vgcreate vg1 /dev/sda2
  • Check volume group has been created successfully:
vgdisplay

This should show 1 volume group consisting of 0 LVs (see Cur LV and 1 PV (see Cur PV).

  • Create a logical volume:
sudo lvcreate --size 30g --name media vg1
  • Format the logical volume as ext3:
mkfs.ext3 /dev/vg1/media
  • Mount the volume by adding the following line to /etc/fstab:
/dev/vg1/media   /var/media   ext3   defaults    0  2