代码改变世界

Mounting the NFS share on a Windows server

2016-08-24 18:57  梁小白  阅读(1180)  评论(0编辑  收藏  举报

今天遇到一个相当奇怪的问题,在windows 上mount LINUX NFS, powershell 脚本可以成功, 用图形界面也可以成功,但BATCH就是不行。提示53网络错误.

不过公司已经有人踩过这个坑了看起来:)

原文在此:

http://www.ibm.com/support/knowledgecenter/SSFHJY_1.0.6/deploy/mount_the_nfs_share_on_windows_servers.html

  1. Ensure that you are logged into the Windows server as an administrator.
  2. Start the command console as the administrator (Click Start > All Programs > Accessories > Windows Powershell or Command Prompt)
  3. Right-click the Windows Powershell or Command Prompt, and select Run as administrator.
    Note: Ensure to select Windows Powershell, not Windows Powershell(x86).
  4. Run the following command to install FS-NFS-Services:

    servermanagercmd.exe -install FS-NFS-Services

  5. Open a command prompt with administrative rights. Run the following command:
    • For IBM Docs: umount –f W:
    • For File Viewer: umount –f Y:
  6. Run:

    nfsadmin client stop

  7. Open Regedit and navigate to the following branch:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default

  8. In the main window, right-click and select New > DWORD 32-bit Value. Set the name as AnonymousGID.
  9. Right-click and select New > DWORD 32-bit Value again. Set the name as AnonymousUID.
  10. Double-click on AnonymousGID and AnonymousUID, set the value as 0 and the base as Decimal respectively.
  11. Click OK.
  12. Close Regedit.
  13. In the command prompt, run:

    nfsadmin client start

  14. Close the Windows Powershell Console.
  15. Open a command prompt.
  16. Run the following command in a command prompt (not Powershell) to set the NFS configuration:

    nfsadmin client localhost config fileaccess=755 SecFlavors=+sys -krb5 -krb5i

  17. Run the following commands to mount the share:
    • For IBM Docs: mount -o mtype=soft retry=10 timeout=6 casesensitive=yes anon DocsLab01.renovations.com:/nfs/docs_data W:
    • For File Viewer: mount -o mtype=soft retry=10 timeout=6 casesensitive=yes anon DocsLab01.renovations.com:/nfs/viewer_data Y:
    Note: If you do not mount successfully, run umount –f W: or umount –f Y: and then repeat again.
  18. In order to mount the share automatically with windows restart:
    1. Create a batch file, for example, c:\IBMConversionNFS\nfsmount.bat, and type:
      mount -o mtype=soft retry=10 timeout=6 casesensitive=yes anon DocsLab01.renovations.com:/nfs/docs_data W:
      mount -o mtype=soft retry=10 timeout=6 casesensitive=yes anon DocsLab01.renovations.com:/nfs/viewer_data Y:
    2. Click Start > Administrative Tools > Task Scheduler.
    3. Click Create Task in Task Scheduler (Local).
    4. Click General, and type nfs_auto_mount for Name. In Security options, click Change User or Group > Advanced > Find Now, and select SYSTEM. Select Run with highest privileges, and click OK.
    5. Click Triggers > New, select At startup for Begin the task. Click OK.
    6. Click Actions > New > Browse, select c:\IBMConversionNFS\nfsmount.bat and click OK.
    7. Click OK.
    Note:
    • If the node and server are configured to start automatically along with the Windows Operating System, they will be system services running with a user name of SYSTEM. Looking at the services with the Task Manager, the user name for java.exe will show SYSTEM. In this case, the mount must also be done with a user of SYSTEM (as previously shown) or the NFS shares will not be able to be accessed from the node or server.
    • If the mount action is done using a user name of SYSTEM, the NFS shares will be able to be accessed regardless of what user name the node or server is running as.

 

更多NFS troubleshooting 参考:

https://wiki.archlinux.org/index.php/NFS/Troubleshooting