MoonPoint Support Logo


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals

Advanced Search
Sun Mon Tue Wed Thu Fri Sat

Sun, Apr 26, 2009 4:19 pm

NFS on Solaris

Solaris 9 and later comes with an NFS server. To use it, edit the /etc/dfs/dfstab file. Place a share command in it using the syntax share [-F FSType] [-o specific_options] [-d description] [pathname].

The following shows an entry made to that file. Folders are shared via NFS using the share command. The options used are explained below:

-F nfsSpecify the filesystem type for sharing to be NFS.
-o rw=PC1Allow read and write access from one one client system named PC1
-d "share"Use share as the description for the share
#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#       Issue the command 'svcadm enable network/nfs/server' to
#       run the NFS daemon processes and the share commands, after adding
#       the very first entry to this file.
#       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2

share -F nfs -o rw=PC1 -d "share" /export/home/jsmith/Documents/share

The options that can be specified with -o are as follows:

     -o specific_options

         The specific_options are used to control access  of  the
         shared resource. (See share_nfs(1M) for the NFS specific
         options.) They may be any of the following:


             pathname is shared read/write to all  clients.  This
             is also the default behavior.


             pathname is shared read/write  only  to  the  listed
             clients. No other systems can access pathname.


             pathname is shared read-only to all clients.

Note: in the example above I used /export/home/jsmith/Documents/share as the directory to be shared. I had to use /export/home/jsmith/Documents/share rather than /home/Documents/jsmith/shared, because under Solaris the /home directory is a special directory. For sharing something under it with NFS, you need to use /export/home.

When I tried sharing the directory with the shareall command when I used /home/jsmith/Documents/share, I received an error message.

# shareall -F nfs
share_nfs: /home/jim/Documents/share: Operation not applicable

Once I used /export/home/jsmith/Documents/share in /etc/dfs/dfstab, I did not receive any error messages when running shareall.

# shareall -F nfs

Once the dfstab file has been edited, start the NFS server with svcadm enable network/nfs/server.

You can check the state of the NFS server with the svc command:

$ svcs network/nfs/server
STATE          STIME    FMRI
disabled       14:19:50 svc:/network/nfs/server:default

You can use the -v option with the svcadm to get more verbose information. You can use the -r option to enable other services on which it depends. Svcadm then enables each service instance and recursively enables its dependencies. If the -s option is specified, svcadm enables each service instance and then waits for each service instance to enter the online or degraded state. svcadm will return early if it determines that the service cannot reach these states without administrator intervention.

# svcadm -v enable -r network/nfs/server
svc:/network/nfs/server:default enabled.
svc:/milestone/network enabled.
svc:/network/loopback enabled.
svc:/network/physical enabled.
svc:/network/nfs/nlockmgr enabled.
svc:/network/rpc/bind enabled.
svc:/system/filesystem/minimal enabled.
svc:/system/filesystem/usr enabled.
svc:/system/boot-archive enabled.
svc:/system/filesystem/root enabled.
svc:/system/device/local enabled.
svc:/system/identity:node enabled.
svc:/system/sysidtool:net enabled.
svc:/milestone/single-user:default enabled.
svc:/milestone/devices enabled.
svc:/system/device/fc-fabric enabled.
svc:/system/sysevent enabled.
svc:/system/manifest-import enabled.
svc:/system/filesystem/local:default enabled.
svc:/milestone/single-user enabled.
svc:/system/filesystem/minimal:default enabled.
svc:/system/identity:domain enabled.
svc:/network/nfs/status enabled.
svc:/system/filesystem/local enabled.
# svcadm enable -s /network/nfs/server

If the service is still marked as disabled, you can use the -d option, which lists the services or service instances upon which the given service instances depend.

# svcs /network/nfs/server
STATE          STIME    FMRI
disabled       14:55:55 svc:/network/nfs/server:default
# svcs -d /network/nfs/server
STATE          STIME    FMRI
disabled       Jul_28   svc:/network/rpc/keyserv:default
disabled       Jul_28   svc:/network/nfs/mapid:default
online         Jul_28   svc:/milestone/network:default
online         Jul_28   svc:/system/filesystem/local:default
online         Jul_28   svc:/network/rpc/bind:default
online         Jul_28   svc:/network/nfs/nlockmgr:default
online         Jul_28   svc:/network/rpc/gss:default

When I tried starting the NFS server software on a Solaris 10 system, I didn't see error messages when I ran svdadm enable -s /network/nfs/server, but when I would check it afterwards with svcs /network/nfs/server, the service was listed as disabled. So I tried enabling the keyserv and mapid services, which were listed as disabled.

# svcs keyserv
STATE          STIME    FMRI
disabled       Jul_28   svc:/network/rpc/keyserv:default
# svcadm enable keyserv
# svcs keyserv
STATE          STIME    FMRI
maintenance    15:43:56 svc:/network/rpc/keyserv:default
# svcadm enable mapid
# svcs mapid
STATE          STIME    FMRI
online         15:44:58 svc:/network/nfs/mapid:default
# svcs /network/nfs/server
STATE          STIME    FMRI
disabled       14:55:55 svc:/network/nfs/server:default
# svcadm enable -s /network/nfs/server
svcadm: Instance "svc:/network/nfs/server:default" has been disabled by another 
# svcs -x  svc:/network/nfs/server
svc:/network/nfs/server:default (NFS server)
 State: disabled since Sun Apr 26 15:45:46 2009
Reason: Disabled by an administrator.
   See: nfsd(1M)
   See: /var/svc/log/network-nfs-server:default.log
Impact: This service is not running.

I finally realized that the NFS service won't start if there is no valid directory share. I had used /home/jsmith/Documents/share in /etc/dfs/dfstab instead of /export/home/jsmith/Documents/share. Once I corrected that problem, I was able to enable the /network/nfs/server service.

# svcs /network/nfs/server
STATE          STIME    FMRI
online         16:15:32 svc:/network/nfs/server:default
# svcadm enable -s /network/nfs/server
# svcs /network/nfs/server
STATE          STIME    FMRI
online         16:15:32 svc:/network/nfs/server:default

I had previously run svcadm enable -r /network/nfs/server to recursively enable any other services that the NFS service depended upon. Since the keyserv and mapid services had been listed as disabled after I ran that command, but I had subsequenty enabled them when I incorrectly concluded that the fact that they were disabled was keeping the NFS server service from running, I disabled them again.

# svcadm disable keyserv
# svcadm disable mapid
# svcadm restart /network/nfs/server
# svcs /network/nfs/server
STATE          STIME    FMRI
online         16:41:38 svc:/network/nfs/server:default

I then checked to verify the system was listening on the default port for NFS, port 2049.

# netstat -an | grep 2049
      *.2049                              Idle
      *.2049                              Idle
      *.2049                                                        Idle
      *.2049               *.*                0      0 49152      0 LISTEN
      *.2049               *.*                0      0 49152      0 LISTEN
      *.2049                            *.*                             0      0 49152      0 LISTEN
# netstat -a | grep nfs
      *.nfsd                              Idle
      *.nfsd                              Idle
      *.nfsd                                                        Idle


  1. Sharing directories with NFS in Solaris 10
    Solaris Administration Secrets and Security
  2. Setting up an NFS Server on Solaris
    Date: December 21, 2003
    Network Administrator Tools
  3. Solaris 10: enable NFS server
    By: qmchenry
    Date: May 20, 2005
    Tech-Recipes - Your cookbook of tech tutorials
  4. [osol-help] unable to bring up nfs server on solaris 10
    Date: May 15, 2007
    The opensolaris-help Archives
  5. NFS: Operation not applicable
    Date: August 12, 2006
    Sun Forums
  6. svcadm fails to enable nfs/server
    Date: August 12, 2008
    SUN Solaris - The UNIX and Linux Forums

[/os/unix/solaris] permanent link

Once You Know, You Newegg AliExpress by

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo