cluster-deployment/jobs/nfs/nfs-setup.sh

46 lines
2.1 KiB
Bash
Executable file

#!/usr/bin/env bash
echo "[job/nfs] Checking NFS mounts" >&2;
# _netdev The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system)
# nofail Do not report errors for this device if it does not exist.
# auto Auto-mount on boot
# noatime No last-access time
# tcp Use tcp, not udp
# bg The system won't block during boot until it is able to mount the filesystem, but won't give up on trying to mount it either.
# timeo=VALUE The time in deciseconds (tenths of a second) the NFS client waits for a response before it retries an NFS request.
# retrans=n The number of times the NFS client retries a request before it attempts further recovery action.
if [[ ! -d /mnt/shared ]]; then
echo "[job/nfs] Creating mount for shared cluster data" >&2;
sudo mkdir -p /mnt/shared;
echo 'magicbag.node.mooncarrot.space:/mnt/elfstone2/cluster /mnt/shared nfs auto,nofail,noatime,_netdev,tcp,bg,timeo=50,retrans=5 0 0' | sudo tee -a /etc/fstab;
sudo mount /mnt/shared;
fi
if [[ ! -d /mnt/elfstone ]]; then
echo "[job/nfs] Creating mount for elfstone" >&2;
sudo mkdir -p /mnt/elfstone;
echo 'magicbag.node.mooncarrot.space:/mnt/elfstone2/main /mnt/elfstone nfs auto,nofail,noatime,_netdev,tcp,bg,timeo=50,retrans=5 0 0' | sudo tee -a /etc/fstab;
sudo mount /mnt/elfstone;
fi
if [[ ! -d /mnt/elessar-music ]]; then
echo "[job/nfs] Creating mount for elessar-music" >&2;
sudo mkdir -p /mnt/elessar-music;
echo 'magicbag.node.mooncarrot.space:/mnt/elfstone2/syncthing/Music /mnt/elessar-music nfs auto,nofail,_netdev,noatime,tcp,bg,timeo=50,retrans=5 0 0' | sudo tee -a /etc/fstab;
sudo mount /mnt/elessar-music;
fi
if [[ ! -d /mnt/elessar-syncthing ]]; then
echo "[job/nfs] Creating mount for elessar-syncthing" >&2;
sudo mkdir -p /mnt/elessar-syncthing;
echo 'magicbag.node.mooncarrot.space:/mnt/elfstone2/syncthing /mnt/elessar-syncthing nfs auto,nofail,_netdev,noatime,tcp,bg,timeo=50,retrans=5 0 0' | sudo tee -a /etc/fstab;
sudo mount /mnt/elessar-syncthing;
fi
echo "[job/nfs] Complete" >&2;