Monday, 24 February 2014

Mounting Solaris NFS Share on Linux(Ubuntu)


  1. When we say we are sharing/mounting partition of one machine on another machine there are some prerequisites that must be first understood and taken care of. First of all both machines must be connected via some network or in other terms both machine must be accessible to each other. How do we check that? -> Simply open command prompt and execute

    ping IPAddress of other machine (Eg. ping

    If the ping is successfull in both ways we are good to proceed.
  2. To fully understand point mentioned above it is important to know that mounting a partition to another machine essentially involves a server-client architecture. The machine whose partition is to be share acts as a server where as machine on which the partition is to be mounted acts as a client.
  3. When we say we have server-client architecture what immediately comes into mind is what rules govern the communication between server and client. More precisely it is called protocol. For eg. files can be shared over FTP(File transfer protocol). For mounting partitions over network we have different set of protocols. Most commonly used are Network File System (NFS) for Linux and Common Internet File System (CIFS) for Windows.
  4. As long as we are on mounting topic it would be beneficial to revise mount and umount System calls as they will be used later.

Before we proceed to see how Solaris partition/share is mounted on a Linux machine you may want to go though how Linux share is mounted on another Linux machine. Following link also provides the basics like installing portmap, understanding exports, mount, umount etc.

How To Set Up an NFS Mount on Ubuntu 12.04 

Mounting Solaris NFS Share on Linux

  1. Create directory on your Solaris machine which you wish to share. Next provide permissions to that directory. You can either use chmod command or you can change permissions from file properties.

  2. By default Solaris or rather mostly all unix based systems have Bourne shell(sh). If you are more comfortable with Bourne Again Shell(bash) like me you can easily switch to it. Steps provided in screen shot below -

  3. Next step is to check if NFS server is up and running. For that you can execute following command in the console -

    svcs | grep nfs

    If you get the output as shown in the screen shot below you are good to proceed. If not then you have to start the nfs server. You can do that with following command -

    svcadm -v enable network/nfs/server
    Similar command goes for disabling the server

    svcadm -v disable network/nfs/server

    Info :
    svcs :- report service status
    For more info execute man svcs on console
    svcadm :- System administation command. Manipulate service instance.
    For more info execute man svcadm on console
  4. Next you need to make an entry of the directory you are going to share in the file /etc/dfs/dfstab. Add following lines to the file and save.(Note : You need su privileges to edit the file).

    #share [-F nfs] [-o specific-options] [-d description] pathname
    share  -F nfs -o rw -d "TestDescription" /Desktop/aniket/mount

  5. Save the changes above and restart the server.Infact for any further changes in this file to take effect you will have to bring down the server amd restart.

    svcadm -v disable network/nfs/server
    svcadm -v enable network/nfs/server
    After restarting the server you can check that that the entry is successfull by executing command - share.
    If you are able to see the entry, execute the command - shareall.
    This will inform your server that the directory represented by the entry made can be shared over the network.
  6. That is all for server(Solaris) side. Now lets move on to Client(Linux/Ubuntu) side. Here you simply need to execute mount system call.

    sudo mount -vt  nfs /home/aniket/SolarisShared/mount/

    or if you wish to remount you can do

    sudo mount -o remount -vt  nfs /home/aniket/SolarisShared/mount/

    By syntax you must have guessed the format is

    mount -vt nfs serverIP:/serverDirPath localDirPath

  7. Finally you can see if the directory is really mounted/mapped. You can see it physically or use the command - mount

Thats all! Let me know if there are any further doubts.
t> UA-39527780-1 back to top