Difference between revisions of "Logical Volume Manager"

From Christoph's Personal Wiki
Jump to: navigation, search
(Examples)
(Examples)
Line 2: Line 2:
  
 
==Examples==
 
==Examples==
 +
===Creating a logical volume===
 
*Prepare a physical volume:
 
*Prepare a physical volume:
 
  fdisk -cu /dev/xvde
 
  fdisk -cu /dev/xvde

Revision as of 19:56, 27 February 2014

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

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