Live hot, Think cool

**** NFS server 설정 ****

nfs 데몬

mountd : /usr/lib/nfs/mountd : NFS client가 mount를 요청시 mountd 데몬이 서버의 공유된
마운트 포인터(file handle)를 넘겨줌 -> /etc/rmtab공유하는 목록 저장

nfsd : /usr/lib/nfs/nfsd : 마운트된 이후에 정보를 핸들할수 있도록 해줌
statd : /usr/lib/nfs/statd : NFS file시스템의 상태정보를 저장
lockd : /usr/lib/nfs/lockd : 서버이상시 락을 건다
nfslogd : /usr/lib/nfs/nfslogd : nfs server 로깅데몬

* statd, lockd는 함께 NFS locking서비스를 제공한다 이는 서버 crashes가 발생시
클라이언트가 다시 파일을 사용할수 있도록 빨리 재 Connection이 되도록 한다.
두 대몬은 /etc/init.d/nfs.client 스크립트로 실행가능.

* nfsd,mountd는 /etc/init.d/nfs.server 스크립트로 실행가능

nfs 파일

/etc/dfs/dfstab : 부팅시 공유할 곳을 지정
/etc/dfs/sharedtab : 현재 공유하고 있는 곳을 저장
/etc/dfs/fstypes : mount명령을 사용시 -F nfs 옵션을 사용하지 않아도 되도록함
/etc/rmtab : 현재 어떤 host가 share된 자원을 공유하고 있는지를 저장(hostname : fsname)
/etc/nfs/nfslog.conf
/etc/default/nfslogd
/etc/nfs/nfslogtab

nfs command 명령어

share : 공유
unshare : 공유해제
shareall : /etc/dfs/dfstab내의 share된 리스트를 참조하여 전부 마운트시킴
unshareall : /etc/dfs/sharetab내의 현재 공유된 리스트를 참조하여 전부 언마운트시킴
dfshares : 공유할 자원이 있는지를 확인
dfmounts : 공유한 자원이 있는지를 확인


nfs server 완 관련된 파일
/etc/vfstab
/etc/mnttab
/etc/dfs/fstypes

-서버설정-

기본적으로 /etc/dfs/dfstab파일내 공유할 폴더를 지정

(file>root)/# vi /etc/dfs/dfstab
share -F nfs -o rw /data

rw ; read-write

ro ; read-only

root=client[:client] ; root access host (client hostname)

anon=0 ; 어느곳에서나 UID 0 (root) 로 access 가능


주. dfstab파일내 공유할 폴더를 지정하지 않고 nfs.server를 실행시
NFS service was not started because /etc/dfs/dfstab has no entries.
이런 메세지와 함께.. 중요 서버데몬(mountd,nfsd)이 실행이 안됨

1. 우선 디렉토리를 공유한다.
#share -F nfs -o rw /usr/share/man
(shareall해도 됨)

2. 공유확인
(file>root)/# share
- /data rw ""
(file>root)/#

3. 데몬확인

(file>root)/# ps -fe | grep lockd
root 197 1 0 16:32:36 ? 0:00 /usr/lib/nfs/lockd
root 1189 1156 0 18:06:19 pts/2 0:00 grep lockd

(file>root)/# ps -ef | grep mountd
root 1191 1156 0 18:06:24 pts/2 0:00 grep mountd
root 208 1 0 16:32:37 ? 0:00 /usr/lib/autofs/automountd
root 371 1 0 16:32:52 ? 0:00 /usr/lib/nfs/mountd

(file>root)/# ps -ef | grep nfsd
root 1196 1156 0 18:06:35 pts/2 0:00 grep nfsd
root 373 1 0 16:32:53 ? 0:00 /usr/lib/nfs/nfsd -a 16

(file>root)/# ps -fe | grep statd
daemon 199 1 0 16:32:36 ? 0:00 /usr/lib/nfs/statd
daemon 999 1 0 17:41:29 ? 0:00 /usr/lib/nfs/statd
root 1199 1156 0 18:06:40 pts/2 0:00 grep statd

(file>root)/#

만약에 위의 데몬들이 떠있지 않으면은 아래의 명령으로 데몬을 실행 시킨다.

(file>root)/#/etc/init.d/nfs.server start

- 서버에서 어떤 자원을 공유하고 있나 확인

(file>root)/etc/dfs# dfshares
RESOURCE SERVER ACCESS TRANSPORT
file:/data file - -
file:/a file - -
(file>root)/etc/dfs#

-> /etc/hosts에 zzz 이 명시되어 있어야한다. 목록에 없으면

(file>root)/etc/dfs# dfshares 192.168.0.212
RESOURCE SERVER ACCESS TRANSPORT
192.168.0.212:/test 192.168.0.212 - -
(file>root)/etc/dfs#

현재 nfs 서버에 접속해 있는 서버를 확인이 가능 합니다.

- 클라이언트 설정 및 데몬 확인

(file>root)ps -ef | grep nfs
root 1593 1 0 18:45:01 ? 0:00 /usr/lib/nfs/lockd
daemon 1591 1 0 18:45:01 ? 0:00 /usr/lib/nfs/statd

- 클라이언트 데몬 실행

(file>root)/etc/init.d/nfs.client start

클라이언트 데몬

(file>root)/etc/init.d# ps -ef | grep nfs
root 1564 1156 0 18:44:20 pts/2 0:00 grep nfs
root 197 1 0 16:32:36 ? 0:00 /usr/lib/nfs/lockd
daemon 199 1 0 16:32:36 ? 0:00 /usr/lib/nfs/statd
daemon 999 1 0 17:41:29 ? 0:00 /usr/lib/nfs/statd


(file>root)mount -F nfs 192.168.0.212:/test /ccc

위의 명령은 mount 명령으로서 192.168.0.212 에 test 로 nfs 가 설정되어 있는
디렉토리를 ccc 란 폴더로 mount 시키라는 명령 입니다.

- nfs 마운트 된 폴더 확인

(file>root)/ccc# df -k
파일시스템 K바이트 사용 가용 용량 설치지점
/dev/dsk/c0t0d0s0 20165785 10219660 9744468 52% /
/proc 0 0 0 0% /proc
fd 0 0 0 0% /dev/fd
mnttab 0 0 0 0% /etc/mnttab
swap 2064904 24 2064880 1% /var/run
swap 2064896 16 2064880 1% /tmp
/dev/dsk/c0t0d0s5 54760503 7704084 46508814 15% /data
192.168.0.212:/test 15116868 3065388 11283576 22% /ccc
(file>root)/ccc#

다른 nfs 서버에 접속해서 공유된 포더에 마운트 되어 있는 상태.....
http://www.readysystem.co.kr/ready/bbs/board.php?bo_table=tech_solaris&wr_id=25&page=12