Skip to main content

NFS export

Create new physical volume, volume group and logical group. Mount it to freshly created directory. Add to fstab for automatic mount during boot process.

Preparations:

#sudo apt install lvm2su
dnf install lvm2\
    nfs-utils

hostname
export host="$(hostname)"
lsblkexport src_host="(source host)"
export dev=src_export="/dev/sdb"(name of exported director)"

showmount -e ${src_host}

export size=dir="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-mnt/${host}-data/lv-${host}-datadata/ncp"
mkdir -p /mnt/${host}-datadir}
mount /dev/vg-${host}-data/lv-src_host}:${host}-datasrc_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 mounted

shutdown -r now