Difference between revisions of "Lvm"

From Linuxintro
imported>ThorstenStaerk
(New page: The '''l'''ogical '''v'''olume '''m'''anager enables you to span a volume that is visible to the user over several physical volumes.)
 
imported>ThorstenStaerk
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
The '''l'''ogical '''v'''olume '''m'''anager enables you to span a volume that is visible to the user over several physical volumes.
 
The '''l'''ogical '''v'''olume '''m'''anager enables you to span a volume that is visible to the user over several physical volumes.
 +
 +
Let's assume you want to group ''sdi'', sdj, sdk and sdl to one big disk.
 +
 +
First prepare the physical volumes:
 +
pvcreate /dev/sdi
 +
pvcreate /dev/sdj
 +
pvcreate /dev/sdk
 +
pvcreate /dev/sdl
 +
 +
Then create a volume group
 +
vgcreate vg1 /dev/sdi /dev/sdj /dev/sdk /dev/sdl
 +
 +
Then create a logical volume with a size of 50GB
 +
lvcreate -L 50G vg1 -n myvol
 +
 +
Format it erasing all data:
 +
mkfs.ext3 /dev/vg1/myvol
 +
 +
Mount it
 +
mkdir /mnt/lvm
 +
mount /dev/vg1/myvol /mnt/lvm
 +
 +
= How to... =
 +
 +
== ... list all volume groups ==
 +
To list all volume groups use the [[command]]
 +
vgs
 +
 +
== ... list all physical volumes ==
 +
To list all physical volumes use the [[command]]
 +
pvs
 +
 +
== ... list all logical volumes ==
 +
To list all logical volumes use the [[command]]
 +
lvs

Latest revision as of 18:23, 1 May 2012

The logical volume manager enables you to span a volume that is visible to the user over several physical volumes.

Let's assume you want to group sdi, sdj, sdk and sdl to one big disk.

First prepare the physical volumes:

pvcreate /dev/sdi
pvcreate /dev/sdj
pvcreate /dev/sdk
pvcreate /dev/sdl

Then create a volume group

vgcreate vg1 /dev/sdi /dev/sdj /dev/sdk /dev/sdl

Then create a logical volume with a size of 50GB

lvcreate -L 50G vg1 -n myvol

Format it erasing all data:

mkfs.ext3 /dev/vg1/myvol

Mount it

mkdir /mnt/lvm
mount /dev/vg1/myvol /mnt/lvm

How to...

... list all volume groups

To list all volume groups use the command

vgs

... list all physical volumes

To list all physical volumes use the command

pvs

... list all logical volumes

To list all logical volumes use the command

lvs