2019-05-23日 nfs回顾及故障处理、nfs优化、邮件

NFS永久挂载、优化、优缺点

1.服务端 nfs rpcbind 开机自启动

  • 查看nfs rpcbind 运行状态及是否开机自启动
[root@nfs01 ~]# systemctl is-active  rpcbind  nfs 
active
active
[root@nfs01 ~]# systemctl is-enabled rpcbind  nfs 
enabled
enabled 

2.如何让nfs永久挂载

  • 方法1( C7 第一次使用 需要 chmod +x /etc/rc.local)
root@web01 /etc]# vim /etc/rc.local
mount -t nfs 172.16.1.31:/upload/ /mnt/
  • 方法2 /etc/fstab 通过/etc/fstab 实现nfs开机自动挂载
root@web01 /etc]vim /etc/fstab
172.16.1.31:/nfs                          /nfs                    nfs     defaults        0 0

通过/etc/fstab 实现nfs开机自动挂载
CentOS6 失败
启动 netfs 服务

nfs故障案例

  • 挂载nfs提示:该目录已被挂载
[root@web01 ~]# mount  172.16.1.31:/nfs  /nfs 
mount.nfs: /nfs is busy or already mounted
  • 查看挂载信息却没有
[root@web01 ~]# df -h
Filesystem        Size  Used Avail Use% Mounted on
/dev/sda3          99G  1.7G   98G   2% /
devtmpfs          476M     0  476M   0% /dev
tmpfs             487M     0  487M   0% /dev/shm
tmpfs             487M   14M  473M   3% /run
tmpfs             487M     0  487M   0% /sys/fs/cgroup
/dev/sda1         197M  105M   93M  54% /boot
tmpfs              98M     0   98M   0% /run/user/0
172.16.1.31:/nfs   99G  1.7G   98G   2% /nfs
  • df -h没有就去看 /proc/mounts
[root@web01 ~]# grep /nfs  /proc/mounts  
172.16.1.31:/nfs /nfs nfs4 rw,relatime,vers=4.1,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=172.16.1.7,local_lock=none,addr=172.16.1.31 0 0

Stale file handle

文件句柄错误
df -h 没有挂载这个 nfs
grep /nfs /proc/mounts 已经挂载

解决:

  • 强制卸载 /nfs
[root@backup ~]# umount -lf /nfs

nfs 指定挂载参数

mount -o rsize=131072,wsize=131072,nosuid,noexec,nodev  172.16.1.31:/nfs  /nfs
mount 指定挂载参数.png

rsize 可读
wsize 可写

nfs错误提示:

an incorrect mount option was specified
不正确的 挂载参数
指定了1个错误的挂载参数

[root@web01 ~]# mount -t nfs -o nosiud,nodev,noexec 172.16.1.31:/data  /mnt
mount.nfs: an incorrect mount option was specified

read-only file system
文件系统只读

解决方式
mount -o rw,remount /

touch: cannot touch ‘/root/alex.txt’: Read-only file system

模拟误操作 /etc/fstab 内容改错导致系统只读

touch: cannot touch ‘/root/alex.txt’: Read-only file system

进入光盘救援模式

troubeshooting ---->rescue

  • 具体操作:
    continue 自动把磁盘的上面的根分区挂载到 /mnt/sysimage
1.shell     手动进行挂载
2.fdisk   -l 
3.mount  /dev/sda3    /mnt/sysimage 
4.chroot  /mnt/sysimage   #把当前系统的根目录设置为 从 /mnt/sysimage  
5.vim /etc/fstab   #修改磁盘上面的文件   
6.重启 

nfs优缺点

nfs优缺点.png

nfs优化

nfs优化.png

nfs优化选项详解

nfs优化选项说明.png
  • 云服务器发邮件 25 smtp
    465 smtps(加密)

【任务】弄1个云服务器 /虚拟机 配置使用465端口(smtps 加密) 发送邮件
163邮箱

sersync

查看网站PV数:

http://alexa.chinaz.com

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容