CentOS 6.6�°��b����NFS4����
��װ NFS ����������������
# yum install nfs-utils rpcbind
useradd -s /sbin/nologin -M www
cat /etc/passwd www uid 505
���� NFS ����
��/etc/exports�ļ�vim /etc/exports
/usr/local/src 192.168.0.0/24(rw,sync)
/var/log 192.168.0.113(rw,async,all_squash,anonuid-505,anongid=505)
����nfs���գ�
���_��rpcbind��nfs�S�C�Ԇ��ӣ�
#chkconfig rpcbind on
# chkconfig nfs on
Ȼ��քe����rpcbind��nfs���գ�
#service rpcbind start
#service nfs start
��� NFS ���������Ƿ���Ŀ¼���?
# showmount -e 192.168.0.113
ʹ�� mount ���ط������˵�Ŀ¼/home/exp���ͻ���ij��Ŀ¼�£�
# mkdir /tmp/mount
# mount -f nfs -onoatime,nolock,intr,rsize=32768,wsize=32768,nfsvses=3 192.168.0.114:/var/log /tmp/mount
# df -h��һ���ρ��˛]�С�
exportfs -rv
������Ŀ¼
ʹ��NFSv4��ʽ������Ŀ¼ʱ�����е�Ŀ¼��Ҫ��Ϊ�����Ŀ¼����Ŀ¼�����磺������Ŀ¼��Ҫ���?
/first/very/long/path1
/second/very/long/path2
ͬʱ�ÿͻ��˿���ȥ�����Ŀ¼�� /dir1 �� /dir2��
�������� ������Ŀ¼ # mkdir /home/nfs/dir1
# mkdir /home/nfs/dir2
ʹ�ò��������Ҫ�����Ŀ¼
# mount --bind /first/very/long/path1 /home/nfs/dir1
# mount --bind /secend/very/long/path2 /home/nfs/dir2
��/etc/exports�ļ�
/home/nfs/dir1 *(rw,nohide,sync,all_squash,anonuid-505,anongid=505)
/home/nfs/dir2 *(rw,nohide,sync,all_squash,anonuid-505,anongid=505)
ע�⣺��Ҫʹ��nohide���� ���¶�ȡNFS�����ļ� # exportfs -rv
��ʱ��Ϳ����ڿͻ����Ϲ��ط������ϵĶ�������ļ����ˣ�
�Ӹ�Ŀ¼����
# mount 192.168.0.114:/ /mount/point/
��������
# mount 192.168.0.114:/dir1 /mount/point1/
# mount 192.168.0.115:/dir2 /mount/point2/
����
��Ĭ������£�NFS �����ò��ʺϴ��������̡�
ÿ���ͻ���Ӧ���� rsize=32768,wsize=32768,intr,noatime ��װԶ���ļ�ϵͳ���硣
mount -o rsize=32768,wsize=32768,intr,noatime server1:/
/mount/point/
�Ӷ�ȷ����
ʹ�ô�Ķ�/д�飨����ָ�������С�������ʾ������ 32KB����
�ڹ���ʱ NFS �������Ա��жϡ�
��������� atime��
���Խ���Щ���÷��� /etc/fstab �С����ʹ���Զ���װ������ôӦ�ý���Щ���÷����ʵ��� /etc/auto.* �ļ��С�
�� �������ˣ�һ��Ҫȷ�����㹻�� NFS �ں��߳����������пͻ�����Ĭ������£�ֻ����һ���̣߳����� Red Hat �� Fedora ϵͳ������ 8 ���̡߳����ڷ�æ�� NFS ��������Ӧ�����������֣����� 32 �� 64�������� nfsstat -rc ���������ͻ����˽��Ƿ���������������������ʾ�ͻ���Զ�̹�̵��ã�RPC��ͳ����ݡ��±���ʾһ�� Web �������Ŀͻ���ͳ����ݡ�
# nfsstat -rc
Client rpc stats:
calls retrans authrefrsh
1465903813 0 0
�ڶ��� retrans ���㣬���ʾ����һ������������û�г�����Ҫ���´������������������ֱȽϴ�Ӧ�ÿ������� NFS �ں��̡߳����÷����ǽ�������߳��������ݸ� rpc.nfsd������ rpc.nfsd 128 ������ 128 ���̡߳��κ�ʱ���Խ����������ã��̻߳�����Ҫ��������١�ͬ���������Ӧ�÷��������ű��У���������ϵͳ������ NFS �Ľű���
���� NFS�����Ҫע��һ�㣺�����ܵĻ���Ӧ�ñ���ʹ�� NFSv2����Ϊ NFSv2 �����ܱ� v3 �� v4 ��öࡣ���ִ�� Linux ���а�����Ӧ�ò������⣬���ǿ����ڷ������ϼ�� nfsstat ��������˽��Ƿ����κ� NFSv2 ���á�
nfs/exports�û�ӳ��ѡ��
all_squash ��Զ�̷��ʵ�������ͨ�û��������鶼ӳ��Ϊ�����û����û��飨nfsnobody����
no_all_squash ��all_squashȡ����Ĭ�����ã���
root_squash ��root�û��������鶼ӳ��Ϊ�����û����û��飨Ĭ�����ã�;
no_root_squash ��rootsquashȡ��,��������root��
anonuid=xxx ��Զ�̷��ʵ������û���ӳ��Ϊ�����û�����ָ�����û�Ϊ�����û���UID=xxx����
anongid=xxx ��Զ�̷��ʵ������û��鶼ӳ��Ϊ������ �����˻�����ָ���������û����˻�Ϊ�����û����˻���GID=xxx����
����ѡ��
secure ���ƿͻ���ֻ�ܴ�С��1024��tcp/ip�˿�����nfs��������Ĭ�����ã���
insecure ����ͻ��˴Ӵ���1024��tcp/ip�˿����ӷ�������
sync �����ͬ��д���ڴ滺����������У�Ч�ʵͣ������Ա�֤��ݵ�һ���ԣ�
async ������ȱ������ڴ滺�����У���Ҫʱ��д����̣�
wdelay ����Ƿ�����ص�д���������������Щд���� һ��ִ�У�����������Ч�ʣ�Ĭ�����ã���
no_wdelay ����д����������ִ�У�Ӧ��sync���ʹ�ã�
subtree �����Ŀ¼��һ����Ŀ¼����nfs������������丸Ŀ¼��Ȩ��(Ĭ������)��
no_subtree ��ʹ���Ŀ¼��һ����Ŀ¼,nfs������Ҳ������丸Ŀ¼��Ȩ��,����������Ч��;
���ij��� ��ѧϰLinux�� ���ͣ�����ر����˳���http://linuxlearn.blog.51cto.com/1437234/1793582