How to create an LVM partition

Below is a quick cheatsheet that lists the commands used to quickly create an LVM partition.

These commands partition a disk using fdisk:

fdisk /dev/sdb (assuming that the drive you want to edit is "sdb")
   create a new partition (n)
   change the partition type to be Linux LVM (t 8e)
   write changes (w)

These are the actual LVM commands:

pvcreate /dev/sdbX
vgcreate vg /dev/sdbX
lvcreate -l +100%FREE -n opt vg
mkfs.xfs /dev/vg/opt

You now have an LVM disk that is formatted as XFS that can be mounted manually or added to your fstab