LVM
Create new physical volume, volume group and logical group. Mount it to freshly created directory. Add to fstab for automatic mount during boot process.
# apt install lvm2
dnf install lvm2
hostname
export host="$(hostname)"
lsblk
export dev="/dev/sdb"
export size="149.9G"
# export fs="ext4"
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
# /dev/mapper/vg--host--data-lv--host--data /mnt/host-data ext4 defaults 0 1
systemctl daemon-reload
# when possible, test VM restart to ensure disk will be mounted
shutdown -r now
No Comments