This is an old revision of the document!
Create And Remove Physical Volumes Assign Physical Volumes To Volume Groups And Create And Delete Logical Volumes
General Information
Working with logical volumes.
Partition Setup
Parition that is prepared for type LVM (8e00)
gdisk /dev/sdb n Partition number: 1 First sector: default Last sector: +30G Hex code type: 8e00 w
Physical Volumes
Create physical volume
pvcreate /dev/sdb1
Summary of physical volumes
pvs
Full display of physical volumes
pvdisplay
Volume Groups
Assign physical volume to new volume group
vgcreate vglocal /dev/sdb1
Assign physical volume to existing volume group
vgextend vglocal /dev/sdb1
Summary of volume groups
vgs
Full display of volume groups
vgdisplay
Logical Volumes
Create logical volume
lvcreate --name lvhome --size 30G vglocal
Summary of logical volumes
lvs
Full display of logical volumes
vgdisplay
File System and Mounting
Create filesystem and mount logical volume
mkfs -t xfs /dev/mapper/vglocal-lvhome mount /dev/mapper/vglocal-lvhome /home
Removals
Delete logical volume
lvremove /dev/mapper/vglocal-lvhome
Remove a physical volume (/dev/sdb1) from a volume group (vglocal)
vgreduce vglocal /dev/sdb1
Delete volume group
vgremove vglocal
Remove physical volume
pvremove /dev/sdb1