Disks and partitions

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

NFS export

Mount it to freshly created directory. Add to fstab for automatic mount during boot process.

Preparations:

sudo su
dnf install \
    nfs-utils

hostname
export host="$(hostname)"

export src_host="(source host)"
export src_export="(name of exported directory)"

showmount -e ${src_host}

export dir="/mnt/${host}-data/data/ncp"
mkdir -p ${dir}
mount ${src_host}:${src_export} /mnt/${host}-data
df -h


#TODO: add into /fstab with oneliner
```bash
${src_host}:${src_export} ${dir} nfs defaults 0 0
echo "add me to fstab"
mount | grep ${host}
nano /etc/fstab
systemctl daemon-reload

when possible, test VM restart to ensure disk will be properly mounted

shutdown -r now