NFS 配置7

2022-07-09 23:29:16 浏览数 (1)

客户端挂载

确保 /etc/init.d/portmap (Centos 5.x) 或 /etc/init.d/rpcbind (Centos 6.x)

/etc/init.d/nfslock 都是启动状态

代码语言:javascript复制
[root@nfs-client ~]# mount -t nfs -o intr nfs-server:/data/nfs /mnt/nfs/ 
[root@nfs-client ~]# df  -h 
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5              95G   22G   69G  25% /
/dev/sda6             429G  215G  192G  53% /opt
/dev/sda3             284G   99G  172G  37% /var
/dev/sda1             494M   36M  434M   8% /boot
tmpfs                  24G     0   24G   0% /dev/shm
nfs-server:/data/nfs
                      1.7T  585G  1.1T  36% /mnt/nfs
[root@nfs-client ~]# 

查看本地挂载参数

使用 mount 不加参数查看

Option

Default

suid/nosuid

suid

rw/ro

rw

dev/nodev

dev

exec/noexec

exec

user/nouser

nouser

auto/noauto

auto

NFS额外的挂载参数

Option

Default

fg/bg

fg

soft/hard

hard

intr

-

rsize/wsize

rsize=1024,wsize=1024

注意

rpcbind (Centos6.x 下) / portmap (Centos5.x 下)


总结

cat /etc/exports

no_root_squash :代表root不进行匿名替换,保留root权限

/etc/init.d/rpcbind (Centos6 与Centos5不同 ,Centos5 下是portmap)

/etc/init.d/nfs

/etc/init.d/nfslock

netstat -tulnp | grep -E ‘(rpc|nfs)’

NFS的启动信息默认会写到 /var/log/messages

rpcinfo -p localhost

rpcinfo -t test nfs

showmount -a localhost

showmount -e localhost

cat /var/lib/nfs/etab

exportfs -ra

grep -v “^#” /etc/sysconfig/nfs

rpcinfo -p | grep -E ‘(rquota|mount|nlock)’

iptables -A INPUT -i em1 -p tcp -s 192.168.1.0/24 -m multiport --dport 111,2049,875,892,32769,32803 -j ACCEPT

iptables -A INPUT -i em1 -p udp -s 192.168.1.0/24 -m multiport --dport 111,2049,875,892,32769,32803 -j ACCEPT

mount -t nfs -o intr nfs-server:/data/nfs /mnt/nfs/

原文地址

0 人点赞