Linux: LVM : Logical Volume Manager : Multiple Hard Disk and Partition and Volume Management

On RedHat/Centos Linux - LVM experiments

Concepts to understand:

Physical Volume: Physical Hard Drive or  Partitions in Physical Hard Drive

Physical Extent:  One unit of space usually 4 MB.

Volume Group: One or multiple Physical Volumes can be assigned to a Volume Group

Logical Volume: Logical volumes are created from the volume groups. This is the volume that users interact with. You mount Logical Volume to work with a logical hard drive space (not partition though similar)

Linux Commands to Know:

pvcreate : create  a physical volume. Initialize a physical drive or partition for LVM

vgcreate: create volume group. Parameters: hard drive or partitions

lvcreate: create logical volume from volume group

lvextend: extend a logical volume

lvresize, lvreduce: to resize or to reduce logical volume

lvremove: to remove a logical volume

 

Some experiment:

I added some hard drives using VMWARE.

lsblk
pvcreate /dev/sdb /dev/sdc
vgcreate vg001 /dev/sdb /dev/sdc
lvcreate -L 500M vg001
lsblk
lvcreate -l 100 vg001
lsblk
pvs
pvdisplay
pvdisplay -v
vgcreate -s 8m /dev/sde
lsblk
vgcreate vg002 -s 8m /dev/sdd
pv
pvs
pvdisplay
lvcreate -L 1G vg002
lsblk
lvextend lv001 +100M
lvextend vg001-lvol0 +100M
lvextend /dev/sdb/vg001-lvol0 +100M
lsblk
lvrename vg01 lvol0 lvolnew
lvrename vg001 lvol0 lvolnew
lsblk
lvextend vg001 lvolnew +100M
lvreduce -L 100m /dev/vg001/lvolnew
lsblk
lvreduce -L 300m /dev/vg001/lvolnew
lvreduce -L 50m /dev/vg001/lvolnew
lvresize -L 700m /dev/vg001/lvolnew
lsblk
lvextend vg001 lvolnew +100M
lvextend /dev/vg001/lvolnew +100M
lvextend -L 100m /dev/vg001/lvolnew
lvextend +100m /dev/vg001/lvolnew
lvextend -L 200 /dev/vg001/lvolnew
lvextend -L 200m /dev/vg001/lvolnew
lvextend -l 200 /dev/vg001/lvolnew
lsblk
lvextend -l 210 /dev/vg001/lvolnew
lsblk
lvextend vg001 lvolnew +100M
history
history > history.txt