Skip to main content

LVM

hostname
export host="$(hostname)"
lsblk
export dev="/dev/xvdb"
export size="99.9G"
export fs="xfs"

pvcreate ${dev}
vgcreate vg-${host}-data ${dev}
lvcreate -L ${size} -n lv-${host}-data vg-${host}-data
lvscan

mkfs.${fs} /dev/vg-${host}-data/lv-${host}-data
mkdir -p /mnt/${host}-data
mount /dev/vg-${host}-data/lv-${host}-data /mnt/${host}-data
df -h

#TODO: add into /fstab with oneliner
echo "add me to fstab"
mount | grep ${host}
nano /etc/fstab
systemctl daemon-reload