blob: 32574c9f29b1880ae0af5ff346bcd5a719affcde [file] [log] [blame]
Guillaume Lambertd9017ef2021-03-08 21:38:31 +01001#!/bin/sh
Roger Maitlandeb412c62018-05-31 14:09:09 -04002
3usage () {
4 echo "Usage:"
5 echo " ./$(basename $0) node1_ip node2_ip ... nodeN_ip"
6 exit 1
7}
8
9if [ "$#" -lt 1 ]; then
10 echo "Missing NFS slave nodes"
11 usage
12fi
13
14#Install NFS kernel
15sudo apt-get update
16sudo apt-get install -y nfs-kernel-server
17
18#Create /dockerdata-nfs and set permissions
19sudo mkdir -p /dockerdata-nfs
20sudo chmod 777 -R /dockerdata-nfs
21sudo chown nobody:nogroup /dockerdata-nfs/
22
23#Update the /etc/exports
24NFS_EXP=""
25for i in $@; do
Guillaume Lambertd9017ef2021-03-08 21:38:31 +010026 NFS_EXP="${NFS_EXP}$i(rw,sync,no_root_squash,no_subtree_check) "
Roger Maitlandeb412c62018-05-31 14:09:09 -040027done
28echo "/dockerdata-nfs "$NFS_EXP | sudo tee -a /etc/exports
29
30#Restart the NFS service
31sudo exportfs -a
32sudo systemctl restart nfs-kernel-server