How to share a directory on Solaris ?

How to create a shared directory in Solaris to be accessible from other nodes in the network ?
Or
How to mount a directory to be accessible from other machines ?
Log in to Solaris machine where you want to share a directory.
In the below example you want to  share "/export/home/builds" directory located on 172.22.23.58.And once is shared you are mounting it on to "/share" directory of another machine.
Note : We have to create an empty directory named "share" under "/" on the machine where we are running the mount to command.
  • Share the directory in the local system
Open the /etc/dfs/dfstab file 

enter: share -F nfs -o rw,anon=0 /export/home/builds

save and exit
  • Execute shareall command
  • Use share command to check the directories shared               
  • Restart the nfs server(Not mandatory)
/etc/init.d/nfs.server stop
       /etc/init.d/nfs.server start
  • Open other system where you need to mount 
  • Execute mount -F nfs 172.22.23.58:/export/home/builds /share command (to mount the /export/home/builds folder in /space) 



How to share a directory in Solaris


"Sharing a directory in Solaris" is a small information but i think it is useful for everyone. I tried to do this, on so many location, some time it is difficult to remember them. So here I am trying to record steps required to do this.

In order to share any directory u need to login as super user. Log into machine and do following steps.
vi /etc/dfs/dfstab

This is a file which is automatically used by 'shareall' command.

Enter directory u want share in this file in following format :-

share [-F fstype] [ -o options] [-d ""] [resource]

For example:-

# Here i am sharing "/export/home/shared/" directory read only for every one.
share -F nfs -o ro -d "shared dirs" /export/home/shared/

# Here i am sharing "/export/home/code_reviews" directory read and write for everyone.
share -F nfs -o rw -d "codereview dirs" /export/home/code_reviews

Now u can run shareall command
shareall

You can also verify this shared directory by following command

-bash-3.00# share
- /export/home/shared ro "shared dirs"
- /export/home/code_reviews rw "codereview dirs"
-bash-3.00#

Thats all..

Same thing can be done on Linux, edit to /etc/exports and running exportfs command does magic for us.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25196159/viewspace-708866/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25196159/viewspace-708866/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值