If there is one service made easy with Solaris it is NFS. Originally developed and designed by SUN NFS is the industry standard UNIX file sharing mechanism today and is likely to remain the dominant player for some time due to its ubiquity, openness, time proven protocol, simplicity and ease of management not to mention the expanse skill base of administrators who use it every day.
If you are following along in my series on building my SunFire V100 with Solaris 10 Core 8/7 then you know that we have gotten all of our filesystems setup and have a large, 106.44GB, ZFS partition mounted as /data. In this very short tutorial we are going to take that directory and make it available to the universe via NFS. Let’s get started.
Firstly we have a very easy time because Solaris installs NFS even with the Core version of the operating system so no worries there. If you don’t believe me you can take a quick look under /etc/init.d/ and you should see your nfs.server daemon script lurking there. It isn’t running yet but it is installed and ready to go.
All we need to do for our simple NFS setup is to make an entry to the filesystem export table /etc/dfs/dfstab (analogous to /etc/exportfs in Linux), enable the NFS service and instruct the system to share the contents of the dfstab. So, start by adding the following line to dfstab:
share -F nfs -o public,nosuid,rw,anon=-1 -d "backup" /data
We can explore the intricacies of this configuration file at another time. The important bits are that you are sharing the directory /data as a readable and writing (rw) directory. If you want remote machines to only be able to read from this directory without being able to make changes use (ro) instead.
Next we need to enable the NFS service in Solaris 10. If you need to look up the instructions for doing this the SUN engineers have thoughtfully included directions right at the top of the /etc/dfs/dfstab file in the comments section. How handy. But so you don’t need to go looking there, here is the command.
# svcadm enable network/nfs/server
There is one last step. Before we can actually use our newly configured NFS shared we need to tell Solaris to go ahead and share the directories. “How do we do that?”, you ask. Simple. Just
At this point your /data directory is available to other NFS enabled computers. Wasn’t that easy? Yes it was.