HOWTO+-+LVM+Linux

Always build your LVM's on top of RAID arrays with fault tolerance!
Create the physical volumes out of your physical disks (RAID preferred) code format="bash" pvcreate /dev/md0 pvcreate /dev/md1 code

Create the volume group vg0 (or give it another name if you want) from the physical volumes we created before. code format="bash" vgcreate vg0 /dev/md0 code

Extend it with the second physical volume code format="bash" vgextend vg0 /dev/md1 code

Create two Logical Volumes on the Volume group we create before (Logical volumes are the final partitions we are going to mount) code format="bash" lvcreate -n mylogicalvolume1 -L 1G vg0 lvcreate -n letsnamethis2 -L 2G vg0 code

Create a Logical volume out of the whole VG space code format="bash" lvcreate -n Terratara -l 100%VG vg0 code

OPTIONAL: Create a filesystem on the logical volumes code format="bash" mkfs.ext4 /dev/vg0/mylogicalvolume1 mkfs.ext4 /dev/vg0/letsnamethis2 code

To extend a logical volume code format="bash" lvextend -L +1G /dev/vg0/mylogicalvolume1 lvextend -l +100%FREE /dev/vg0/mylogicalvolume1 code

To shrink code format="bash" lvreduce -L -1G /dev/vg0/letsnamethis2 code

In both of the above case you will need to resize your filesystem code format="bash" umount /dev/vg0/mylogicalvolume1 e2fsck -f /dev/vg0/mylogicalvolume1 resize2fs /dev/vg0/mylogicalvolume1 code

Display information for the physical volumes code format="bash" pvdisplay code

Display information for the Volume Groups code format="bash" vgdisplay code

Display information for the Logical Volumes code format="bash" lvdisplay code

Further reading (Very interesting ;)
Removing physical volumes from a volume group []

Creating a logical volume []

Reducing a logical volume []

Taking a Backup Using Snapshots []

Removing an Old Disk []

Moving a volume group to another system []

Splitting a volume group []

Converting a root filesystem to LVM 1 []

Recover physical volume metadata []

You don't really want to reach the point of needing the information contained in the following pdf..... When Good Disks Go Bad: Dealing With Disk Failures Under LVM!