快速业务通道

Remote Share with NFS on Linux

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-04-24
NFS can mount a remote directory as local (ex. Server1:/yofee server2:/s1yofee),we can copy,modify,delete and save it as local files. You can deploy it with below workflow. RemoteServer site:

1.login to server1 as root
2. Check whether the process of portmap works with this command:
# ps -aux|grep portmap

it should showed us the detail information about the process of portmap, otherwise we must start this service by manual

# /etc/rc.d/init.d/portmap start

3. Add these info as below into this file /etc/exports

/yofee server2(rw,root_squash) server3(rw,root_squash)

/yofee is a directory what we will shared on server1,and the server2 & server3 are local PC(of course, we can put it as IPaddress), rw is means that after mounted we can read and write it, if we using ro instead of rw,we can only read it. root_squash tell us the root can not write it after mounted, otherwise we can also use this one no_root_squash.

4. Start or restart the process of nfs
# / etc/rc.d/init.d/nfs start

5. If we hope the remote directory has mounted to local PC automatically when the local PC restart.we should create two link file about it.

# ln -s /etc/rc.d/init.d/portmap /etc/rc.d/rc5.d/S18portmap
# ln -s /etc/rc.d/init.d/nfs /etc/rc.d/rc5.d/S28nfs

Local site:

1. Login on server2 or server3 as root. Start the service of portmap
# /etc/rc.d/init.d/portmap restart

2.create a mountsite for remoteserver directory (a Local directory)
#mkdir /s1yofee

3. Add these information as below into this file /etc/fstab
server1:/yofee /s1yofee nfs deaults 0 0

4. Mount the remoteServer directory.
# mount -a

5.list the local mountsite directory and confirm whether it is the same as remote directory
# ls /s1yofee

Now, we can see the share directory from server1 on the local site.

BTW:pay attention to the order of service start. First : portmap then: nfs
For the command of exportfs If we start the service of nfs and then modified the /etc/exports, shall we restart the nfs? No, we can use exportfs to active this process immediate.
exportfs [-aruv]
-a :mount all of the contents about /etc/exports
-r :mount /etc/exports again
-u :umount the directory
-v :print to screen when export it

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号