NFS服务器搭建

创建NFS共享目录,

服务端ip192.168.1.11  主机名:hate

客户端ip192.168.1.10  主机名:love

[root@hate ~]# mkdir -p /nfs/backup

[root@hate ~]# chmod -R 777 /nfs

修改/etc/exports

/nfs/backup        love(rw,async,nohide,no_subtree_check)

注意:这里的解析名一定要用hostname,否则会出现权限的问题

[root@hate ~]# showmount -e

mount clntudp_create: RPC: Program not registered

遇到这个问题时解决办法

[root@hate ~]# /etc/init.d/nfs restart

[root@hate ~]# showmount -e

Export list for hate:

/nfs/backup love
[root@hate ~]# service nfs restart

[root@hate ~]# chkconfig nfs on

 

客户端192.168.1.10挂载NFS文件系统

[root@love ~]# mkdir /mynfs

手动挂载

[root@love ~]#  mount -o rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,vers=3,timeo=600 hate:/nfs/backup /mynfs

[root@love ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

                       45G  9.3G   33G  23% /

/dev/sda1              99M   12M   82M  13% /boot

tmpfs                1014M     0 1014M   0% /dev/shm

hate:/nfs/backup       45G  6.5G   36G  16% /mynfs

实现开机自动挂载

[root@love ~]# vi /etc/rc.local 

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.

 

touch /var/lock/subsys/local

添加如下配置:这样还可以支持RMAN备份。

modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

/bin/mount -o rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,vers=3,timeo=600  hate:/nfs/backup /mynfs

重启系统

[root@love ~]# reboot

[root@love ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

                       45G  9.3G   33G  23% /

/dev/sda1              99M   12M   82M  13% /boot

tmpfs                1014M     0 1014M   0% /dev/shm

192.168.1.11:/nfs/backup   45G  6.5G   36G  16% /mynfs

 

 

 

posted @ 2014-03-29 15:25  ArcerZhang  阅读(194)  评论(0编辑  收藏  举报