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 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% Client rpc: Connection oriented: calls badcalls badxids timeouts newcreds badverfs timers 17 0 0 0 0 0 0 cantconn nomem interrupts 0 0 0 Connectionless: calls badcalls retrans badxids timeouts newcreds badverfs 4 1 0 0 0 0 0 timers nomem cantsend 1 0 0 Client nfs: calls badcalls clgets cltoomany 4 1 4 2 Version 2: (3 calls) null getattr setattr root lookup readlink read wrcache 0 0% 1 33% 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% 2 66% 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 0 0% Client nfs_acl: Version 2: (1 calls) null getacl setacl getattr access getxattrdir 0 0% 0 0% 0 0% 1 100% 0 0% 0 0% Version 3: (0 calls) null getacl setacl getxattrdir 0 0% 0 0% 0 0% 0 0%
|
|
Copyright © 2004-2010 Jo HoSeok. All rights reserved. |