Linux云计算学习笔记day35

NFS永久挂载
服务端 nfs rpcbind 开机自启动

[root@nfs01 ~]# systemctl is-active  rpcbind  nfs 
active
active
[root@nfs01 ~]# systemctl is-enabled rpcbind  nfs 
enabled
enabled 

方法1 /etc/rc.local
chmod +x /etc/rc.d/rc.local

方法2 /etc/fstab 通过/etc/fstab 实现nfs开机自动挂载

172.16.1.31:/nfs /nfs nfs defaults 0 0

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

[root@web01 ~]# mount  172.16.1.31:/nfs  /nfs 
mount.nfs: /nfs is busy or already mounted
[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
[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@web01 ~]# cp /bin/ls  /nfs
cp: failed to access ‘/nfs’: Stale file handle
[root@web01 ~]# cp /bin/ls  /nfs/
cp: failed to access ‘/nfs/’: Stale file handle
[root@web01 ~]# cd /nfs/
-bash: cd: /nfs/: Stale file handle
[root@web01 ~]# mkdir -p /nfs/
mkdir: cannot create directory ‘/nfs/’: File exists
[root@web01 ~]# rm -r /nfs/
rm: cannot remove ‘/nfs/’: Stale file handle

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

mount -o rsize=131072,wsize=131072,nosuid,noexec,nodev  172.16.1.31:/nfs  /nfs

read-only file system

文件系统只读
touch: cannot touch ‘/root/alex.txt’: Read-only file system

mount -o rw,remount /

进入光盘救援模式

troubeshooting ---->rescue

continue 自动把磁盘的上面的根分区挂载到 /mnt/sysimage

shell 手动进行挂载

fdisk -l

mount /dev/sda3 /mnt/sysimage

chroot /mnt/sysimage #把当前系统的根目录设置为 从

/mnt/sysimage

vim /etc/fstab #修改磁盘上面的文件

重启

云服务器发邮件 25 smtp
465 smtps(加密)

你可能感兴趣的:(Linux云计算学习笔记day35)