How to share a directory through nfs

This is quite simple than you thought. First just make sure that your nfs server is enabled or not with the following command:

# svcs network/nfs/server
STATE          STIME    FMRI
online         16:01:36 svc:/network/nfs/server:default

And if working you will get an output as shown above or else you will get something like…

STATE          STIME    FMRI
disabled       17:42:25 svc:/network/nfs/server:default

If this is the case you need to enable your nfs server with svcadm command as shown below:

# svcadm enable network/nfs/server

Confirm that your nfs server is running with the above command.

Once you are sure that your nfs is running, next task is to share the directory.

Now for example purpose, say you want to share ‘/export/home/share’ directory. Fire the following command straight away:

#/usr/sbin/share -F nfs -o ro,anon=0 /export/home/share

To check all the directories shared on your Solaris system, use the share command:


-               /nbsin_share   ro,anon=0   ""   /export/home/share

And you should get the output as shown above.

But make a note that this is a temporary sharing of the directory. If you happen to reboot your system or restart the nfs service the sharing will be disabled.

By default only those directories are shared by the nfs server who have an entry into its configuration file located at ‘/etc/dfs/dfstab’

So to make our above directory sharing persist forever we will append our share command into dfstab file:

#echo "/usr/sbin/share -F nfs -o ro,anon=0 /export/home/share" >> /etc/dfs/dfstab

Then we’ll ask the nfs service to share all the directories as metioned in dfstab file with the following command:


You can crosscheck your sharing by ‘share’ command as now you already know.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: