blob: 4a7a8dbc129d41ded2013b31b837b966e437e8aa [file] [log] [blame]
Roger Maitlandeb412c62018-05-31 14:09:09 -04001#!/bin/bash
2
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
26 NFS_EXP+="$i(rw,sync,no_root_squash,no_subtree_check) "
27done
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