Software >> OS >> Unix >> Linux >> RHEL >> LVM >> How to add new disk to lvm and create new volume group and logical volume and create new filesystem on it

# lsblk

e.g. there is new disk sdb

# pvcreate /dev/sdb

NOTE: if using partition /dev/sdb1 instead of whole disk /dev/sdb and partition was newly created but not visible, use partprobe /dev/sdb

# pvs

# vgcreate vg1 /dev/sdb

# vgs

create new logical volume using 100% of the space in the vg

# lvcreate -l 100%FREE -n lv1 vg1

( to create 20g for example : lvcreate -L 20g -n lv1 vg1  or  lvcreate --size 20g --name lv1 vg1)

# lvs

create new file system on that lv

# mkfs -t ext4 /dev/vg1/lv1

mount the file system to /app

# mkdir /app

# mount -t ext4 /dev/vg1/lv1 /app

 

References

[1] https://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/index.html
[2] https://www.thegeekstuff.com/2010/08/how-to-create-lvm/