Difference between revisions of "Logical Volume Manager"
From Christoph's Personal Wiki
(New page: This article will explain how to use the '''Logical Volume Manager''' ('''LVM''') in Linux. ==Examples== *Prepare a physical volume: fdisk -cu /dev/xvde pvcreate /dev/xvde1 pvs *Cr...) |
(→Examples) |
||
Line 5: | Line 5: | ||
fdisk -cu /dev/xvde | fdisk -cu /dev/xvde | ||
pvcreate /dev/xvde1 | pvcreate /dev/xvde1 | ||
+ | pvdisplay /dev/xvde1 | ||
pvs | pvs | ||
*Create a volume group: | *Create a volume group: | ||
vgcreate vgname /dev/xvde1 | vgcreate vgname /dev/xvde1 | ||
+ | vgdisplay vgname | ||
vgs | vgs | ||
*Create and use a new logical volume: | *Create and use a new logical volume: | ||
lvcreate -n lvname -L 1G vgname | lvcreate -n lvname -L 1G vgname | ||
+ | lvdisplay /dev/vgname/lvname | ||
lvs | lvs | ||
ls -l /dev/vgname/lvname | ls -l /dev/vgname/lvname |
Revision as of 19:55, 27 February 2014
This article will explain how to use the Logical Volume Manager (LVM) in Linux.
Examples
- 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