Difference between revisions of "Logical Volume Manager"

From Christoph's Personal Wiki
Jump to: navigation, search
(Examples)
Line 1: Line 1:
 
This article will explain how to use the '''Logical Volume Manager''' ('''LVM''') in [[Linux]].
 
This article will explain how to use the '''Logical Volume Manager''' ('''LVM''') in [[Linux]].
 +
 +
''Note: This article will cover how to use LVM under RedHat-style distros. Everything was tested using [[CentOS]] 6.5.''
  
 
==Examples==
 
==Examples==

Revision as of 01:32, 9 March 2014

This article will explain how to use the Logical Volume Manager (LVM) in Linux.

Note: This article will cover how to use LVM under RedHat-style distros. Everything was tested using CentOS 6.5.

Examples

Creating a logical volume

  • Prepare a physical volume:
fdisk -cu /dev/xvde
pvcreate /dev/xvde1
pvdisplay /dev/xvde1
pvs
  • Create a volume group:
vgcreate vgname /dev/xvde1
vgdisplay vgname
vgs
  • Create and use a new logical volume:
lvcreate -n lvname -L 1G vgname
lvdisplay /dev/vgname/lvname
lvs
ls -l /dev/vgname/lvname
#~OR~
ls -l /dev/mapper/vgname-lvname
mkfs.ext4 /dev/vgname/lvname
mkdir /data
  • Make it persistent by adding the following line to your /etc/fstab file:
/dev/mapper/vgname-lvname  /data  ext4  defaults  1 2
mount -a