Network File System (NFS) is a client-server file system that allows users in client system to access files across the network as if they are in the local box. Here we will see how to setup a NFS server share, where client can access it across the network.
NFS Server Side configurations
1. First check if NFS server service is running:
2. Start the service and check again:
3. Start NFS share of the directory(/opt/nfsshare):
The command syntax is:
4. Now check the share:
We have successfully shared the files at location /opt/nfsshare from our server. But the shares will not persist system reboots. Let us un-share it and then share it persistently.
5. The command to unshare:
For persisting the share across system reboots we need to add the entry in file /etc/dfs/dfstab.
6. Open the file /etc/dfs/dfstab with an editor e.g. vi, and add the entry:
NFS Server Side configurations
1. First check if NFS server service is running:
root@redcoral#svcs -a | grep nfs
disabled Jan_15 svc:/network/nfs/server:default
online Jan_15 svc:/network/nfs/client:default
online Jan_15 svc:/network/nfs/rquota:default
online Jan_15 svc:/network/nfs/status:default
online Jan_15 svc:/network/nfs/nlockmgr:default
online Jan_15 svc:/network/nfs/cbd:default
online Jan_15 svc:/network/nfs/mapid:default
It is disabled.2. Start the service and check again:
root@redcoral#svcadm enable network/nfs/server
root@redcoral#svcs -a | grep nfs
online Jan_15 svc:/network/nfs/client:default
online Jan_15 svc:/network/nfs/rquota:default
online Jan_15 svc:/network/nfs/status:default
online Jan_15 svc:/network/nfs/nlockmgr:default
online Jan_15 svc:/network/nfs/cbd:default
online Jan_15 svc:/network/nfs/mapid:default
online 0:26:14 svc:/network/nfs/server:default
3. Start NFS share of the directory(/opt/nfsshare):
root@redcoral#share -F nfs -o ro -d "My NFS share" /opt/nfsshare/
The command syntax is:
In the above share we have provided ro=readonly access to /opt/nfsshareshare [-F nfs] [-o specific-options] [-d description] pathname
4. Now check the share:
root@redcoral#share
- /opt/nfsshare ro "My NFS share"
We have successfully shared the files at location /opt/nfsshare from our server. But the shares will not persist system reboots. Let us un-share it and then share it persistently.
5. The command to unshare:
This will stop a NFS sharing of an already shared directory(here its /opt/nfsshare/).root@redcoral#unshare -F nfs /opt/nfsshare/
For persisting the share across system reboots we need to add the entry in file /etc/dfs/dfstab.
6. Open the file /etc/dfs/dfstab with an editor e.g. vi, and add the entry:
share -F nfs -o ro -d "Our NFS share" /opt/nfsshare/
7. Reboot the box or issue the following command to start sharing:
root@redcoral#shareall -F nfs
root@redcoral#share
- /opt/nfsshare ro "Our NFS Share"
Thats all, we have successfully shared the files under /opt/nfsshare.
Incase if we would want to stop all NFS shares from our server:
unshareall -F nfs
Next we will see how to setup NFS client in another box in our network.
For Sharing files between Windows and Unix, refer here.
No comments:
Post a Comment