Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

How To Set Up an NFS Mount on Ubuntu 16.04

1,260 bytes removed, 12:50, 7 March 2018
no edit summary
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
===Step 4 — Adjusting the Firewall on the Host===
First, let’s check the firewall status to see if it’s enabled and if so, to see what's currently permitted:
sudo ufw statusOutputStatus: active To Action From-- ------ ----OpenSSH ALLOW AnywhereOpenSSH (v6) ALLOW Anywhere (v6)On our system, only SSH traffic is being allowed, so we’ll need to add a rule for NFS traffic. With many applications, you can use sudo ufw app list and enable them by name, but nfs is not one of those. Because ufw also checks /etc/services for the port and protocol of a service, we can still add NFS by name. Best practice recommends that you enable the most restrictive rule that will still allow the traffic you want to permit, so rather than enabling traffic from just anywhere, we’ll be specific. Use the following command to open port 2049 on the host, being sure to substitute your client's ip address: sudo ufw allow from 203.0.113.256 to any port nfsYou can verify the change by typing: sudo ufw statusYou should see traffic allowed from port 2049 in the output: OutputStatus: active To Action From-- ------ ----OpenSSH ALLOW Anywhere2049 ALLOW 203.0.113.256OpenSSH (v6) ALLOW Anywhere (v6)This confirms that UFW will only allow NFS traffic on port 2049 from our client machine. ===Step 5 4 — Creating the Mount Points on the Client===
Now that the host server is configured and serving its shares, we’ll prepare our client.
sudo mkdir -p /nfs/general
 
sudo mkdir -p /nfs/home
 ===Step 6 5 — Mounting the Directories on the Client===
Now that we have some place to put the remote shares and we've opened the firewall, we can mount the shares by addressing our host server, which in this guide is 203.0.113.0, like this:
sudo mount 203.0.113.0:/var/nfs/general /nfs/general<br>sudo mount 203.0.113.0:/home /nfs/home
These commands should mount the shares from the host computer onto the client machine. You can double-check that they mounted successfully in several ways. You can check this with a plain mount or findmnt command, but df -h will give you more human readable output illustrates how disk usage is displayed differently for the nfs shares:
df -h 
Output
 
<code>
Filesystem Size Used Avail Use% Mounted on
udev 238M 0 238M 0% /dev
203.0.113.0:/home 20G 1.2G 18G 7% /nfs/home
203.0.113.0:/var/nfs/general 20G 1.2G 18G 7% /nfs/general
</code>
 
Both of the shares we mounted appear at the bottom. Because they were mounted from the same file system, they show the same disk usage. To see how much space is actually being used under each mount point, use the disk usage command du and the path of the mount. The -s flag will provide a summary of usage rather than displaying the usage for every file. The -h will print human readable output.