Computer Tips - Linux: LVM on the command line

Date: 2019aug8 Q. Linux: LVM on the command line A. As root... Use fdisk to partition it
fdisk /dev/sda Replace with your actual disk n Use the `n` command an accept defaults w Ask to have it written q Quit
Create physical volume (PV)
pvcreate /dev/sda3 Replace with your actual disk pvcreate /dev/sda4 Replace with your actual disk
Create volume group (VG)
vgcreate minevg /dev/sda3 /dev/sda4
List
vgdisplay
Create logical volumes (LV)
lvcreate -n lvmine1 --size 99G minevg
List
lvdisplay
Format
mkfs.ext4 /dev/minevg/lvmine1
Mount
mkdir /mine1 mount /dev/minevg/lvmine1 /mine1
Add to /etc/fstab
/dev/minevg/lvmine1 /mine1 ext4 defaults 1 2