手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

RedHat5.5和Solaris10 Linux设置共享

[日期:2012-09-17] 来源:csdn  作者:linghe301 [字体:大 中 小]

=====================================Solaris 10======================================

以一台机器为例:我的/export/home路径下有四个文件夹:aaa、bbb、ccc、ddd

目的是:

共享/export/home/aaa  映射到/export/home/bbb

共享/export/home/ccc  映射到/export/home/ddd

修改/etc/dfs/dfstab文件

  1. bash-3.00# vi /etc/dfs/dfstab  
  2.   
  3.   
  4. "/etc/dfs/dfstab" 12 lines, 430 characters  
  5.   
  6. #       Place share(1M) commands here for automatic execution  
  7. #       on entering init state 3.  
  8. #  
  9. #       Issue the command 'svcadm enable network/nfs/server' to  
  10. #       run the NFS daemon processes and the share commands, after adding  
  11. #       the very first entry to this file.  
  12. #  
  13. #       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]  
  14. #       .e.g,  
  15. #       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2  
  16. share -F nfs -o /export/home/ccc  
  17. share -F nfs -o  /export/home/aaa  
因为这是在本机测试,共享给本机这两个文件夹
  1. share -F nfs -o  /export/home/aaa  

如果是共享给另外一台或者两台机器

  1. share -F nfs -o rw=app1:app2 /opt/arcgis/server/serverdir  
  2. share -F nfs -o rw=59.255.44.13 /opt/arcgis/server/serverdir  
app1、app2、59.255.44.13这些都是共享目的机器的机器名和IP.

然后执行share命令

  1. bash-3.00# share /export/home/aaa  
  2. bash-3.00# share /export/home/ccc  
  3. bash-3.00# share  
  4. -               /export/home/ccc   rw   ""  
  5. -               /export/home/aaa   rw   ""  
我们可以看到这些文件夹已经共享上了

然后我们进行映射修改/etc/vfstab

  1. bash-3.00# vi /etc/vfstab  
  2. "/etc/vfstab" 14 lines, 521 characters  
  3. #device         device          mount           FS      fsck    mount   mount  
  4. #to mount       to fsck         point           type    pass    at boot options  
  5. #  
  6. fd      -       /dev/fd fd      -       no      -  
  7. /proc   -       /proc   proc    -       no      -  
  8. /dev/dsk/c0d0s1 -       -       swap    -       no      -  
  9. /dev/dsk/c0d0s0 /dev/rdsk/c0d0s0        /       ufs     1       no      -  
  10. /dev/dsk/c0d0s7 /dev/rdsk/c0d0s7        /export/home    ufs     2       yes  
  11. -  
  12. /devices        -       /devices        devfs   -       no      -  
  13. sharefs -       /etc/dfs/sharetab       sharefs -       no      -  
  14. ctfs    -       /system/contract        ctfs    -       no      -  
  15. objfs   -       /system/object  objfs   -       no      -  
  16. swap    -       /tmp    tmpfs   -       yes     -  
  17. 192.168.205.140:/export/home/ccc - /export/home/ddd nfs - yes -  
  18. 192.168.205.140:/export/home/aaa - /export/home/bbb nfs - yes -  
相关格式

那个机器共享的IP:共享机器共享的路径 -  映射到本机的路径   nfs - yes -

  1. 192.168.205.140:/export/home/ccc - /export/home/ddd nfs - yes -  
  2. 192.168.205.140:/export/home/aaa - /export/home/bbb nfs - yes -  
如上所示,共享的/export/home/aaa文件夹,映射到/export/home/bbb即可

然后执行mount命令

  1. bash-3.00# mount /export/home/ddd  
  2. nfs mount: mount: /export/home/ddd: Device busy  
  3. bash-3.00# mount /export/home/bbb  
  4. nfs mount: mount: /export/home/bbb: Device busy  
  5. bash-3.00# mount  
  6. / on /dev/dsk/c0d0s0 read/write/setuid/devices/intr/largefiles/logging/xattr/one                                                                                                             rror=panic/dev=1980000 on Mon Jun 25 13:47:53 2012  
  7. /devices on /devices read/write/setuid/devices/dev=4780000 on Mon Jun 25 13:47:3                                                                                                             9 2012  
  8. /system/contract on ctfs read/write/setuid/devices/dev=47c0001 on Mon Jun 25 13:                                                                                                             47:39 2012  
  9. /proc on proc read/write/setuid/devices/dev=4800000 on Mon Jun 25 13:47:39 2012  
  10. /etc/mnttab on mnttab read/write/setuid/devices/dev=4840001 on Mon Jun 25 13:47:                                                                                                             39 2012  
  11. /etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4880001 on Mon Jun                                                                                                              25 13:47:39 2012  
  12. /system/object on objfs read/write/setuid/devices/dev=48c0001 on Mon Jun 25 13:4                                                                                                             7:39 2012  
  13. /etc/dfs/sharetab on sharefs read/write/setuid/devices/dev=4900001 on Mon Jun 25                                                                                                              13:47:40 2012  
  14. /lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/dev=1                                                                                                             980000 on Mon Jun 25 13:47:49 2012  
  15. /dev/fd on fd read/write/setuid/devices/dev=4a80001 on Mon Jun 25 13:47:53 2012  
  16. /tmp on swap read/write/setuid/devices/xattr/dev=4880002 on Mon Jun 25 13:47:55                                                                                                              2012  
  17. /var/run on swap read/write/setuid/devices/xattr/dev=4880003 on Mon Jun 25 13:47                                                                                                             :55 2012  
  18. /export/home on /dev/dsk/c0d0s7 read/write/setuid/devices/intr/largefiles/loggin                                                                                                             g/xattr/onerror=panic/dev=1980007 on Mon Jun 25 13:48:56 2012  
  19. /export/home/bbb on 192.168.205.140:/export/home/aaa remote/read/write/setuid/de                                                                                                             vices/xattr/dev=4b00006 on Mon Jun 25 14:46:42 2012  
  20. /export/home/ddd on 192.168.205.140:/export/home/ccc remote/read/write/setuid/de                                                                                                             vices/xattr/dev=4b00007 on Mon Jun 25 14:59:44 2012  
相关测试:

在机器1上共享的路径下创建一个文件,在机器2的相关映射路径下能够看到。

linux
相关资讯       RedHat Linux教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款