root@wl ~ # vi /etc/hosts 192.168.0.11 wl2 root@wl ~ # vi /etc/dfs/dfstab share -F nfs -o rw=wl2 -d "WL2 SHARE" /export/home/share 1) root@wl ~ # shareall 2) root@wl ~ # share 3) - /export/home/share rw=wl2 "WL2 SHARE" root@wl ~ #1) -F는 파일 시스템을 지정하는 것으로 nfs로 고정되어있다. -o 에는 옵션을 써준다. rw=wl2의 의미는 wl2서버에서 접속시 rw(읽기/쓰기)가 가능하도록 한다는 뜻이다. -d의 문자는 단순한 설명문이다. 마지막은 공유할 디렉토리를 전체경로로 입려한다. NFS서버를 세팅하는 가장 단순한 방법이다. 다른 옵션에 대한 설명은 [man share_nfs]를 참조한다.
root@wl2 ~ # mkdir /root/share
root@wl2 ~ # vi /etc/hosts
192.168.0.3 wl
root@wl2 ~ # mount -F nfs wl:/export/home/share /root/share 1)
root@wl2 ~ #
1) wl2에서, wl에서 공유한 /export/home/share 디렉토리를 /root/share 에 마운트한다.
root@wl2 ~ # vi /etc/vfstab ... wl:/export/home/share - /root/share nfs - yes - ... root@wl2 ~ # svcs | grep nfs online 3:46:12 svc:/network/nfs/cbd:default online 3:46:12 svc:/network/nfs/mapid:default online 3:46:12 svc:/network/nfs/status:default online 3:46:12 svc:/network/nfs/nlockmgr:default online 3:46:21 svc:/network/nfs/client:default root@wl2 ~ #서버는 해야할 필요 없다. (이미 되어있다)
root@wl ~ # mkdir /nfs root@wl ~ # mkdir /nfs/share root@wl ~ # share -F nfs -o ro /nfs root@wl ~ # share -F nfs -o rw /nfs/share share_nfs: /nfs/share: 부모 디렉토리(/nfs)가 이미 공유되었습니다 root@wl ~ #단 예외가 있는데, 마운트 지점이 다른 경우는 공유가 된다. ZFS를 사용하는 경우 아래와 같이 생성하면 된다.
root@wl ~ # mkdir /nfs root@wl ~ # mkdir /nfs/share root@wl ~ # zfs create rpool/nfssample root@wl ~ # zfs set mountpoint=/nfs/share rpool/nfssample root@wl ~ # share -F nfs /nfs root@wl ~ # share -F nfs /nfs/share root@wl ~ # share - /nfs/share rw "" - /nfs rw "" root@wl ~ #
root@wl2 ~ # ps -ef | grep auto
root 2202 1 0 10월 1 ? 0:00 /usr/lib/autofs/automountd
root 2203 2202 0 10월 1 ? 0:30 /usr/lib/autofs/automountd
root@wl2 ~ # svcs | grep autofs
online 10월_10 svc:/system/filesystem/autofs:default
root@wl2 ~ #
automound 는 /etc/auto_master 파일로 설정한다. 솔라리스를 설치하고 별다른 수정사항이 없다면 아래와 같이 되어있을 것이다.
root@wl2 ~ # cat /etc/auto_master +auto_master /net -hosts -nosuid,nobrowse /home auto_home -nobrowse root@wl2 ~ #또한 /etc/auto_home 파일도 확인해보자. 이 파일에서 auto_home 이란 이름은 /etc/auto_master 파일에서 /home으로 시작하는 컬럼에 지정된 이름과 같은 것이다.
root@wl2 ~ # cat /etc/auto_home +auto_home root@wl2 ~ #
root@wl ~ # useradd -d /export/home/windy -c "윈디하나" -g staff -m -u 101 -s /bin/bash windy root@wl ~ # vi /etc/dfs/dfstab share -F nfs -o rw=wl2 -d "windy share" /export/home/windy root@wl ~ # shareall root@wl ~ #서버는 통상적인 NFS 공유 설정과 다를 것이 없다.
root@wl2 ~ # vi /etc/auto_home
windy wl:/export/home/windy
root@wl2 ~ # useradd -d /home/windy -c "윈디하나" -g staff -u 101 -s /bin/bash windy
root@wl2 ~ # su - windy
windy@wl2 ~ $ pwd
/home/windy
windy@wl2 ~ $
클라이언트는 automountd 를 위해 /etc/auto_home를 수정하고 홈 디렉토리를 automountd 가 관리하는 /home/windy를 가리키도록 한다. 평상시에는 마운트되지 않다가 windy 가 wl2에 로그인 해서 홈 디렉토리로 현재 디렉토리를 옮길 때 자동으로 마운트 될 것이다.
root@wl2 ~ # cd /net
root@wl2 /net # ls -alF
총 4
dr-xr-xr-x 1 root root 1 11월 6일 14:59 ./
drwxr-xr-x 25 root root 26 11월 6일 14:59 ../
root@wl2 /net # cd /net/wl 1)
root@wl2 /net/wl # ls -alF
총 3
dr-xr-xr-x 2 root root 2 11월 6일 15:08 ./
dr-xr-xr-x 2 root root 2 11월 6일 14:59 ../
dr-xr-xr-x 1 root root 1 11월 6일 15:08 export/
root@wl2 /net/wl # cd ./export/home
root@wl2 /net/wl/export/home # ls -al
...
dr-xr-xr-x 1 root root 1 11월 3일 15:49 share
dr-xr-xr-x 1 root root 1 11월 3일 15:49 windy
root@wl2 /net/wl/export/home #
1) [/net/wl] 대신 [/net/192.168.0.3]과 같이 wl의 IP를 써줄 수도 있고 도메인 명을 써줄수도 있다. [/net/wl2]와 같이 자신의 호스트로 접속할 수도 있다.
root@wl ~ # share -F nfs -o anon=101 /nfs root@wl ~ # share - /nfs anon=101 "" root@wl ~ # chmod 777 /nfs root@wl2 ~ # mount -F nfs wl:/nfs /nfs root@wl2 ~ # touch /nfs/sample root@wl2 ~ # ls -al /nfs/sample -rw-r--r-- 1 windy 101 0 11월 24일 10:23 /nfs/sample101은 windy 사용자의 uid 이다. /nfs/sample 파일의 소유자가 windy 로 된 것을 확인할 수 있다.
root@wl2 ~ # umount /nfs root@wl ~ # unshare /nfs
root@wl ~ # share -F nfs -o root=wl2 /nfs root@wl2 ~ # mount -F nfs wl:/nfs /nfs root@wl2 ~ # touch /nfs/sample root@wl2 ~ # ls -al /nfs/sample -rw-r--r-- 1 root root 0 11월 24일 10:27 sample root@wl2 ~ # chown windy /nfs/sample root@wl2 ~ # ls -al /nfs/sample -rw-r--r-- 1 windy root 0 11월 24일 10:27 sample소유자가 root 로 생성되었고, chown명령을 이용해 소유자를 바꿀 수 있다.
root@wl2 ~ # umount /nfs root@wl ~ # unshare /nfs
root@wl ~ # vi /etc/dfs/dfstab
share -F nfs -o rw=wl2,log=global -d "WL2 SHARE" /export/home/share
root@wl ~ # shareall
root@wl ~ # share
- /export/home/share rw=wl2,log=global "WL2 SHARE"
root@wl ~ # svcadm restart network/nfs/server:default 1)
root@wl2 ~ # mount -F nfs -o vers=3 wl:/export/home/share /root/share 2)
root@wl ~ # cat /var/nfs/nfslog 3) 메시지 생략 Mon Nov 3 17:13:05 2008 0 wl2 0 /export/home/share/source/top-3.7/m_sunos5.o b _ remove r 60001 nfs3-tcp 0 * 메시지 생략1) /etc/nfs/nfslogtab 파일이 있어야 nfslogd 데몬이 실행된다. 없다면 shareall부터 다시하자.
root@wl ~ # vi /etc/nfs/nfslog.conf
global defaultdir=/var/nfs \
log=nfslog fhtable=fhtable buffer=nfslog_workbuffer logformat=extended
root@wl ~ # vi /etc/default/nfslogd
MIN_PROCESSING_SIZE=1024
root@wl ~ # svcadm restart network/nfs/server:default
root@wl2 ~ # mount -F nfs -o ro=@192.168.0:@xxx.xxx.xxx.xxx,rw=wl:wl2:.solanara.net,actimeo=0,forcedirectio \ wl:/export/home/share /root/share root@wl2 ~ # mount -F nfs -o rw,bg,hard,nointr,rsize=32768,wsize=32768,proto=tcp,vers=3,noac,forcedirectio \ wl:/export/home/share /root/share
root@wl ~ # vi /etc/dfs/dfstab share -F nfs -o ro -d "windy share2" /export/home/windy2 share -F nfs -o ro -d "windy share" /export/home/windy root@wl ~ # shareall
root@wl2 ~ # mount -o ro wl:/export/home/windy2,wl:/export/home/windy /root/share
root@wl2 ~ # df -k /root/share
파일시스템 K바이트 사용 가용 용량 설치지점
wl:/export/home/windy2,wl:/export/home/windy
62907203 17956504 44321627 29% /root/share
root@wl2 ~ # nfsstat -m
/root/share from wl:/export/home/windy2,wl:/export/home/windy
Flags: vers=4,proto=tcp,sec=sys,hard,intr,llock,link,symlink,acl,rsize=1048576,wsize=1048576,retrans=5,timeo=600
Attr cache: acregmin=3,acregmax=60,acdirmin=30,acdirmax=60
Failover: noresponse=0,failover=0,remap=0,currserver=wl
root@wl2 ~ #
root@wl ~ # nfsstat -s Server rpc: Connection oriented: calls badcalls nullrecv badlen xdrcall dupchecks dupreqs 0 0 0 0 0 0 0 Connectionless: calls badcalls nullrecv badlen xdrcall dupchecks dupreqs 0 0 0 0 0 0 0 Server nfs: calls badcalls 0 0 Version 2: (0 calls) null getattr setattr root lookup readlink read wrcache 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% write create remove rename link symlink mkdir rmdir 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% readdir statfs 0 0% 0 0% Version 3: (0 calls) null getattr setattr lookup access readlink 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% read write create mkdir symlink mknod 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% remove rmdir rename link readdir readdirplus 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% fsstat fsinfo pathconf commit 0 0% 0 0% 0 0% 0 0% Version 4: (0 calls) null compound 0 0% 0 0% Version 4: (0 operations) reserved access close commit 0 0% 0 0% 0 0% 0 0% create delegpurge delegreturn getattr 0 0% 0 0% 0 0% 0 0% getfh link lock lockt 0 0% 0 0% 0 0% 0 0% locku lookup lookupp nverify 0 0% 0 0% 0 0% 0 0% open openattr open_confirm open_downgrade 0 0% 0 0% 0 0% 0 0% putfh putpubfh putrootfh read 0 0% 0 0% 0 0% 0 0% readdir readlink remove rename 0 0% 0 0% 0 0% 0 0% renew restorefh savefh secinfo 0 0% 0 0% 0 0% 0 0% setattr setclientid setclientid_confirm verify 0 0% 0 0% 0 0% 0 0% write release_lockowner illegal 0 0% 0 0% 0 0% Server nfs_acl: Version 2: (0 calls) null getacl setacl getattr access getxattrdir 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% Version 3: (0 calls) null getacl setacl getxattrdir 0 0% 0 0% 0 0% 0 0%
root@wl2 ~ # nfsstat -c Client rpc: Connection oriented: calls badcalls badxids timeouts newcreds badverfs timers 1229652 3 2 0 0 0 0 cantconn nomem interrupts 0 0 2 Connectionless: calls badcalls retrans badxids timeouts newcreds badverfs 0 0 0 0 0 0 0 timers nomem cantsend 0 0 0 Client nfs: calls badcalls clgets cltoomany 1219703 3 1218231 53 Version 2: (0 calls) null getattr setattr root lookup readlink read wrcache 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% write create remove rename link symlink mkdir rmdir 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% readdir statfs 0 0% 0 0% Version 3: (1218930 calls) null getattr setattr lookup access readlink 0 0% 7567 0% 239 0% 24540 2% 3433 0% 0 0% read write create mkdir symlink mknod 743 0% 1150738 94% 47 0% 21 0% 0 0% 0 0% remove rmdir rename link readdir readdirplus 25352 2% 1162 0% 2 0% 0 0% 0 0% 3113 0% fsstat fsinfo pathconf commit 6 0% 5 0% 0 0% 1962 0% Version 4: (0 calls) null compound 0 0% 0 0% Version 4: (0 operations) reserved access close commit 0 0% 0 0% 0 0% 0 0% create delegpurge delegreturn getattr 0 0% 0 0% 0 0% 0 0% getfh link lock lockt 0 0% 0 0% 0 0% 0 0% locku lookup lookupp nverify 0 0% 0 0% 0 0% 0 0% open openattr open_confirm open_downgrade 0 0% 0 0% 0 0% 0 0% putfh putpubfh putrootfh read 0 0% 0 0% 0 0% 0 0% readdir readlink remove rename 0 0% 0 0% 0 0% 0 0% renew restorefh savefh secinfo 0 0% 0 0% 0 0% 0 0% setattr setclientid setclientid_confirm verify 0 0% 0 0% 0 0% 0 0% write 0 0% Client nfs_acl: Version 2: (0 calls) null getacl setacl getattr access getxattrdir 0 0% 0 0% 0 0% 0 0% 0 0% 0 0% Version 3: (709 calls) null getacl setacl getxattrdir 0 0% 708 99% 0 0% 1 0%
root@wl ~ # nfsstat -m /home/windy /home/windy from wl2:/export/home/windy Flags: vers=3,proto=tcp,sec=none,hard,intr,link,symlink,acl,rsize=32768,wsize=32768,retrans=5,timeo=600 Attr cache: acregmin=3,acregmax=60,acdirmin=30,acdirmax=60
calls RPC 콜 회수 badcalls RPC 계층에서 거절된 콜 회수(badlen 과 xdrcall 의 합) nullrecv 유효하지 않은 RPC콜 회수 badlen 최소한의 RPC콜 길이보다 짧은 RPC콜 회수 xdrcall XDR 디코드 할 수 없는 RPC 콜 회수 dupchecks 이중 요청 캐시에서 발견된 RPC 콜 개수 dupreqs 이중 요청 회수
calls RPC 콜이 만들어진 회수
badcalls RPC 계층에서 거절된 콜 회수
badxids 서버로부터 호출에 부합하지 않은 미해결된 응답을 받은 회수.
서버와 클라이언트 사이의 네트워크에 물리적인 문제가 있을 수 있다.
timeouts 서버로부터 응답이 없어 타임아웃된 회수
newcreds 인증정보가 갱신된 회수
badverfs 응답에 올바르지 않은 검사자로 인한 호출 실패 회수
timers 계산된 타임아웃 값이 호출시 최소로 정의된 타임 아웃 값보다 크거나 작은 회수.
타임 아웃으로 처리 되진 않았지만 엄밀하게 말해 타임 아웃 된 호출 회수.
cantconn 서버와의 접속에 실패로 인한 호출 실패 회수
nomem 메모리 할당 실패로 인한 호출 실패 회수
interrupts 처리가 완료되기전 시그널에 의해 중단된 콜 회수
retrans 클라이어늩에서 서버로부터 응답을 기다리는 도중 타임아웃되어 재전송한 회수. (connection-less인 경우)
cantsend 클라이언트에서 RPC 요청을 보낼 수 없는 회수. (connection-less인 경우)
sec 아래값중 하나
none 인증 없음
sys 유닉스 스타일 인증 (UID, GID)
short 쇼트핸드 유닉스 스타일 인증
dh DES 스타일 인증(암호화된 타임스탬프)
krb5 커버로스 v5 스타일 인증
krb5i 커버로스 v5 스타일 인증. 무결성 지원.
krb5p 커버로스 v5 스타일 인증. 보안 지원.
hard 하드 마운트
soft 소프트 마운트
intr 하드 마운트시 취소 가능
nointr 하드 마운트시 취소 불가
noac 속성을 캐시하지 않음
rsize 읽기 버퍼 크기(바이트)
wsize 쓰기 버퍼 크기(바이트)
retrans NFS 재전송
timeo NFS 타임아웃 초기값(1/10초)
nocto No close-to-open consistency.
llock Local locking being used (no lock manager).
grpid System V group id inheritance.
rpctimesync RPC 시간 동기화
아래의 플래그값은 시스템 내부적으로 사용함:
printed "응답없음" 메시지 출력됨
down 서버 다운
dynamic 동적 전송 크기 수정
link 서버는 링크를 지원
symlink 서버는 심볼릭 링크를 지원
readdir instead of readdirplus 대신 readdir 을 사용
acl 서버는 NFS ACL을 지원
아래 플래그 값은 추가적인 마운트 정보와 관련됨:
vers NFS 버전
proto 프로토콜
The -m option also provides attribute cache timeout values.
The following fields in -m ouput provide timeout values for
attribute cache:
acregmin Minimum seconds to hold cached file
attributes.
acregmax Maximum seconds to hold cached file
attributes.
acdirmin Minimum seconds to hold cached
directory attributes.
acdirmax Maximum seconds to hold cached
directory attributes.
The following fields in -m output provide failover informa-
tion:
noresponse How many times servers have failed to
respond.
failover How many times a new server has been
selected.
remap How many times files have been re-evaluated
to the new server.
currserver Which server is currently providing NFS ser-
vice. See the System Administration Guide:
IP Services for additional details.
The fields in -m output shown below provide information on
dynamic retransmissions. These items are displayed only
where dynamic retransmission is in use.
srtt The value for the smoothed round-trip time,
in milliseconds.
dev Estimated deviation, in milliseconds.
cur Current backed-off retransmission value, in
milliseconds.
|
|
Copyright © 2004-2012 Jo HoSeok. All rights reserved. |