1.放在/etc/rc.local
chmod +x /etc/rc.local
echo "/bin/mount -t nfs 172.16.1.31:/data /mnt" >> /etc/rc.local
tail -2 /etc/rc.local
2.放在/etc/fstab(坑)
1.加载/etc/fstab
2.加载防火墙
3.加载网卡
添加以下内容
172.16.1.31:/data /mnt nfs defaults 0 0
开启延迟启动服务
systemctl enable remote-fs.target
reboot
3.在/etc/fstab 挂载的时候添加一个_netdev参数
172.16.1.31:/data /mnt nfs defaults,_netdev 0 0
_netdev
The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount
these filesystems until the network has been enabled on the system).