how to setup NFS service
Steps to setup NFS¶
Installing NFS Server and NFS Client¶
install
1 2 3 |
|
Start the services on both machines.
1 2 3 4 |
|
Setting Up the NFS Server¶
Configure Export directory
1 2 3 4 5 6 |
|
NFS Options
- ro: With the help of this option we can provide read only access to the shared files i.e client will only be able to read.
- rw: This option allows the client server to both read and write access within the shared directory.
- sync: Sync confirms requests to the shared directory only once the changes have been committed.
- no_subtree_check: This option prevents the subtree checking. When a shared directory is the subdirectory of a larger file system, nfs performs scans of every directory above it, in order to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security.
- no_root_squash: This phrase allows root to connect to the designated directory.
Config firewall
1 2 3 4 5 |
|
Auto run after reboot
1 |
|
show NFS share
1 2 3 |
|
Restart NFS service
1 |
|
List NFS clients connected to NFS server
1 2 |
|
Setting Up the NFS Client¶
Mount Shared Directories on NFS Client
1 2 3 4 |
|
Mount Shared NFS Directory
1 |
|
Check Mount infomation
1 2 3 4 |
|
We need to make an entry in “/etc/fstab“ to mount an NFS directory permanently on your system across the reboots.
1 2 3 |
|
Removing the NFS Mount¶
1 2 |
|
Important commands for NFS¶
- showmount -e : Shows the available shares on your local machine
- showmount -e server-ip : Lists the available shares at the remote server
- showmount -d : Lists all the sub directories
- exportfs -v : Displays a list of shares files and options on a server
- exportfs -a : Exports all shares listed in /etc/exports, or given name
- exportfs -u : Unexports all shares listed in /etc/exports, or given name
- exportfs -r : Refresh the server’s list after modifying /etc/exports
- netstat -tulpen | grep 2049 : show nfs port status
- rpcinfo -p server-ip : Lists the available RPC infomation at the remote server
- cat /var/lib/nfs/etab : check NFS detail configurations