Monday, October 13, 2008

How to share and Access file on Solaris machine

In this example I will share a file from jupiter machine and then access it on neptune machine. Both machine uses Solaris platform.
1)On jupiter machine,

bash-3.00$ hostname
jupiter

Log on as a root user,
bash-3.00$ su
Password:

Change shell to bash
# bash

To make share persistence (after reboot is will also show) edit /etc/dfs/dfstab entry. Here I want to share directory /export/home/oracle and sharing option is read write.
# vi /etc/dfs/dfstab
share -F nfs -o rw /export/home/oracle

rw means read write permission You can also want to give ro (read only) instead of read write.

If you want it temporary you can do,
# share -F nfs -o rw /export/home/oracle
Restart your nfs server.
# /etc/init.d/nfs.server stop
# /etc/init.d/nfs.server start


Have a look at whether nfs server is running or not.
# ps -ef | grep nfs
daemon 317 1 0 Oct 10 ? 0:00 /usr/lib/nfs/lockd
daemon 311 1 0 Oct 10 ? 0:00 /usr/lib/nfs/statd
daemon 313 1 0 Oct 10 ? 0:03 /usr/lib/nfs/nfsmapid
daemon 291 1 0 Oct 10 ? 0:00 /usr/lib/nfs/nfs4cbd
root 12741 12424 0 03:20:34 pts/4 0:00 grep nfs

This must show statd and lockd running. In fact The statd and lockd must be running on server and
client.

Have a look at which file is shared and it's mode.
# share
- /export/home/oracle rw ""

2)On Saturn machine log on as a root user
oracle@neptune ~$ su -
Password:

Create a directory where you mount the network location.
root@neptune /# mkdir /export/home/oracle/remote

Mount the network drive
root@neptune /# mount -F nfs jupiter:/export/home/oracle /export/home/oracle/remote

Or, with more options issue,
# mount -o rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,actimeo=0 jupiter:/export/home/oracle /export/home/oracle/remote
See whether it is mounted.
root@neptune /# df -h
.
.

jupiter:/export/home/oracle
20G 7.6G 12G 39% /export/home/oracle/remote

Now do work is it /export/home/oracle/remote is your local disk location.
Related Documents
Memory Usage of Solaris Operating System

2 comments:

  1. This is very useful. Thanks

    ReplyDelete
  2. Hey Thanks for the post. Its relly helpfull.

    ReplyDelete