Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

How To Set Up an NFS Mount on Ubuntu 16.04

54 bytes added, 12:58, 7 March 2018
no edit summary
 <div style='"text-align: center;'">'''''/etc/exports   '''''</div>
<code>/var/nfs/general 203.0.113.256(rw,sync,no_subtree_check)</code>
sudo systemctl restart nfs-kernel-server
Before you can actually use the new shares, however, you’ll need to be sure that traffic to the shares is permitted by firewall rules
 
To compare the permissions of the General Purpose share with the Home Directory share, create a file Home Directory the same way:
sudo touch /nfs/home/home.test
Then look at the ownership of the file:
ls -l /nfs/home/home.test
Output
  -rw-r--r-- 1 root root 0 Aug 1 13:32 /nfs/home/home.test
We created home.test as root via the sudo command, exactly the same way we created the general.test file. However, in this case it is owned by root because we overrode the default behavior when we specified the no_root_squash option on this mount. This allows our root users on the client machine to act as root and makes the administration of user accounts much more convenient. At the same time, it means we don’t have to give these users root access on the host.
sudo nano /etc/fstab
 
At the bottom of the file, we're going to add a line for each of our shares. They will look like this:
/etc/fstab
. . .
203.0.113.0:/var/nfs/general /nfs/general nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0
203.0.113.0:/home /nfs/home nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0
 . . .
 
203.0.113.0:/var/nfs/general /nfs/general nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0<br>203.0.113.0:/home /nfs/home nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0
Note: More information about the options we are specifying here can be found in the man page that describes NFS mounting in the fstab with the man nfs command.
If you no longer want the remote directory to be mounted on your system, you can unmount it by moving out of the share's directory structure and unmounting, like this:
cd ~<br>sudo umount /nfs/home<br>sudo umount /nfs/general
This will remove the remote shares, leaving only your local storage accessible:
df -h
Output
Filesystem Size Used Avail Use% Mounted on<br>/dev/vda 59G 1.3G 55G 3% /<br>none 4.0K 0 4.0K 0% /sys/fs/cgroup<br>udev 2.0G 12K 2.0G 1% /dev<br>tmpfs 396M 320K 396M 1% /run<br>none 5.0M 0 5.0M 0% /run/lock<br>none 2.0G 0 2.0G 0% /run/shm<br>none 100M 0 100M 0% /run/user
If you also want to prevent them from being remounted on the next reboot, edit /etc/fstab and either delete the line or comment it out by placing a # symbol at the beginning of the line. You can also prevent auto-mounting by removing the auto option, which will allow you to mount it manually.