Chinaunix首页 | 论坛 | 博客
  • 博客访问: 204362
  • 博文数量: 78
  • 博客积分: 1580
  • 博客等级: 上尉
  • 技术积分: 635
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-27 11:06
文章分类

全部博文(78)

文章存档

2007年(6)

2006年(72)

我的朋友
最近访客
NFS

分类:

2006-08-14 10:50:49


NFS=Network File System

bullet What is NFS
bullet

A network file system developed by Sun Microsystem Since 1980, and is available almost for all kinds of UNIX systems now.

bullet

A distributed file system that provide transparent access to remote disks. User access remote disks as if they are local.

bullet

Allows centralized administration of disks usage. 

bullet

Proveide File system consistency, because there is only one copy of each file on the network.

bullet

NFS for Linux Since kernel 1.0.

bullet

NFS是一個通用於各種UNIX平台間的檔案分享協定。
 

bullet NFS Server & NFS Client
bullet

An NFS server is a host that owns one or more file systems and makes them available on the network for  other machines.

bullet

A NFS client mount filesystems from one or more servers.
 

bullet 提供NFS服務的三個程式(On the server)
bullet

rpc.portmapper

bullet

Convert Remote Procedure Call (RPC) program numbers into Internet Protocol port numbers. Needed also in NIS (YP) service. The name of this daemon depends on the UNIX vender! On linux it's“portmap”.portmap本身並不提供NFS服務,他的工作是將其他電腦的呼叫正確的對應到NFSNIS程式。

bullet

RPC Portmapper (portmap)是一個server程式,功能是將RPC program number轉換為TCP/IP Port Number。

bullet

所有透過RPC機構運作的Client/Server程式,都必須由RPC portmapper提供轉換的服務。(例如NFS、NIS)

bullet

標準的RPC Server通常由inetd負責,因此RPC portmapper通常必須先inetd啟動。

bullet

確定系統中RPC portmapper是否啟動的方法:
(1).
nmc:~#
ps aux|grep port
bin 62 0.0 0.2 976 376 ? S 12:40 0:00 /usr/sbin/rpc.portmap
root 3990 0.0 0.2 1052 368 p2 S 08:36 0:00 grep port
(2).
nmc:~#
rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100005 1 udp 669 mountd
100005 2 udp 669 mountd
100005 1 tcp 672 mountd
100005 2 tcp 672 mountd
100003 2 udp 2049 nfs
100003 2 tcp 2049 nfs
100007 2 udp 721 ypbind
100007 2 tcp 723 ypbind

bullet

rpc.mountd
Answer file system mount requests. Read the /etc/exports file to determine which file system are available to which machines and which users. The name of this daemon depends on the UNIX vender! On linux it's "rpc.mountd"
rpc.mountd提供遠端電腦架設(mount)及卸載(umount)檔案系統的服務

bullet

rpc.nfsd
Handle file requests from clients. How many nfsd  to be started depends on the load expected on that server. To start n nfsds just enter"nfsd n". Duplicated nfsds can serve multiple files request concurrently ! The name of this daemon depends on the UNIX vender! On linux the name is  "rpc.nfsd".
rpc.nfsd會將對NFS的要求轉換成為本地檔案系統的實際要求。
 

bullet

啟動NFS Server

bullet

/etc/rc.d/init.d/nfs startor just type /usr/sbin/mountd; /usr/sbin/nfsd 8
 

bullet

停止NFS Server

bullet

/etc/rc.d/init.d/nfs stop
 

bullet

Monitor NFS Server Status

bullet

/etc/rc.d/init.d/nfs status

bullet

NFS Server 組態設定(/etc/exports)

bullet

/etc/exports define the access control list (ACL) for file systems which are exported to NFS clients

bullet

NFS檔案分享(export)最小單位為"directory"

bullet

Format of /etc/exports
/directory/to/export    host1(permission)    host2(permission) ...
hostx 的格式可以是:

bullet

*
"*"
代表所有主機皆可存取

bullet

主機名稱
主機名稱應定義在DNS/etc/hostsNIS

bullet

IP Address[/netmask]
140.120.2.0/24  (
相當於140.120.2.0/255.255.255.0)
140.120.2.0/16  (
相當於140.120.2.0/255.255.0.0)

permission代表hostx對分享的目錄存取權限:

bullet

rw
有讀寫存取權

bullet

ro
唯讀

bullet

noaccess
拒絕存取,通常用在表示分享目錄下的例外。

bullet

no_root_squash
承認Client root的絕對權限。未指定此選項,Client端的root會以"nobody"的身分對NFS檔案存取。

bullet

/etc/exports一經修改必須讓rpc.mountdrpc.nfs重讀該檔案。方法有二:一為重新啟動NFS By : /etc/rc.d/init.d/nfs restart ,另一個則是By指令"exportfs -a"
 

bullet

Example
   /home    nmc1(rw)    nmc2(ro)    nmc3(rw,no_root_squash)
 

bullet

mount NFS file system

bullet

指令格式:    mount -o 參數  server_name:/exported/dir    /local/dir/to_mount  
 server_name
        NFS Server
/exported/dir
       
NFS Server /etc/exports中export的directory
/local/dir/to_mount
        這是local mount point,通常是一個已經存在的空目錄
參數

bullet

rw           讀寫

bullet

ro            read only

bullet

bg           background mount (mount process go to background in case of mount fail !)

bullet

soft         soft mount(default NFS mount is "hard mount",hard mount will keep on trying till mount completed,soft mount will return error code after number of unsuccessful trying specified in "retrans"

bullet

retrans     max retry of soft mount

bullet

wsize      write size(default is 8192 Bytes)

bullet

rsize        read size(default is 8192 Bytes)

bullet

Example
mount -o soft,bg    nmc:/home /home

bullet

NFS File System in /etc/fstab

bullet

Format:    server_name:/exported/dir    /local/dir/to_mount    nfs    NFS參數     fs_freq    fs_passno  

bullet

Example
        nmc:/home    /home    nfs    rw,bg,soft    0    0

bullet

NFS其他相關議題

bullet

慎選NFS參數

bullet

NFS Tunning

bullet

慎防NFS Cross Mount

bullet

Security in NFS

阅读(985) | 评论(0) | 转发(0) |
0

上一篇:Solaris网卡应用

下一篇:NIS

给主人留下些什么吧!~~