Sharing and mounting a directory under solaris 10

A fundamental for any Solaris systems administrator is to know how to share and mount an NFS file system;

On the Solaris 10 server we need to verify if the NFS daemon is running in the machine.

# svcs network/nfs/server

If the NFS service is not running, type the command:

# svcadm enable network/nfs/server

Now we have the NFS server up and running, lets take a look at the currently shared file systems:

# share

The above command will probably return nothing if we've never shared anything from this server before. so lets go ahead and add an entry to be shared

# vi /etc/dfs/dfstab

For this example we'll add /shared as the directory and cain and abel as users who have read-write access

# share -F nfs -o rw=cain:abel /shared

These are some of the options that you could use:

ro=list - Allows read-only access specified by list rw=list - Allows read/write access specified by list root=list - Allows root access specified by list


*lists are colon (:) delimited

*lists can be ipaddresses, hostnames, userids *no list means all

Activate the new NFS share:

# shareall -F nfs

NOTE: You can type the share command directly on the commads line without adding it to /etc/dfstab, but it'll only be active until you unshare or reboot the server.

Now we've got the server side sorted, we can mount our new NFS share on the client system.

Edit /etc/vfstab to add the new NFS share to be mounted:

# vi /etc/vfstab

Add the entry similar to the following

nfsserver:/shared - /shared nfs -yes rw

Create the directory where the share should be mounted:

# mkdir -p /shared

Mount the nfs share using the mountall command or:

# mount /shared

To list all mounts, just type :

# mount

Consult the man pages for more information.