Linux搭建NFS提供磁盤給Windows使用


在Windows2008系統下設置掛載Linux服務器磁盤


一、系統環境

系統平台:CentOS release 5.8 (Final)

NFS Server IP:X....X...153.157

防火牆已關閉

[root@htuidc ~]# setenforce 0

 

[root@htuidc ~]# service iptables stop

 

/iptables: Firewall is not running.

SELINUX=disabled


二、安裝NFS服務

[root@htuidc ~]# yum install nfs-utils-* portmap-*  rpcbind
-y
[root@htuidc ~]# vi /etc/exports 

/aaa *(rw,no_root_squash)
/aaa 42.51.0.0/16(rw)

[root@htuidc aaa]# /etc/init.d/rpcbind restart
Stopping rpcbind:                                          [  OK  ]
Starting rpcbind:                                          [  OK  ]
[root@htuidc aaa]# /etc/init.d/nfs restart
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Shutting down RPC idmapd:                                  [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]

設置NFS服務器的自動啟動狀態
[root@htuidc /]# chkconfig --level 35 portmap on
[root@htuidc /]# chkconfig --level 35 nfs on
[root@htuidc /]# chkconfig --list portmap
portmap         0:off 1:off 2:off 3:on 4:on 5:on 6:off
[root@htuidc /]# chkconfig --list nfs
nfs             0:off 1:off 2:off 3:on 4:off 5:on 6:off

三.Windows2008開啟NFS功能

 
 



    可以看到UID=-2由於在存儲設備上共享出來的NFS文件系統歸屬於root權限,並且無法修改該所屬用戶,而Windows通過UID=-2的用戶去寫,肯定寫不進去。
    
    解決辦法就是讓Windows 7在掛載NFS的時候將UID和GID改成0即可:打開注冊表:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default,增加兩項:AnonymousUid,AnonymousGid,如圖:


   重新啟動計算機,重新mount即可。此時就能在Windows 7下對nfs文件系統進行讀寫操作了,跟本地磁盤一樣。


卸載:
umount X:\
查看幫助:
mount -t

 






免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM