LVM

From Bits Wiki

Jump to: navigation, search

⇒ By Andy Smith | Last updated: Tue, 23 Mar 2010 17:06:49 +0000 by Andys

Adding a disk

  • Set the partition type in fdisk to be 8e (Linux LVM)
  • Add to LVM with pvcreate path-to-device
Example: Add /dev/sda1 to LVM
# pvcreate /dev/sda1

Creating a volume group

  • Use vgcreate group-name path-to-device
Example: Create a volume group called testvg, with /dev/sda1 as the first disk
# vgcreate testvg /dev/sda1

Creating a logical volume

  • Use lvcreate -l extents -n logical-volume-name volume-group
  • The amount of extents available per volume group can be found by looking at the output of vgdisplay (listed as Total PE)
Example: Create a logical volume called testvol in the volume group testvg, 2000 extents in size
# lvcreate -l 2000 -n testvol testvg
elsewhere