介绍如何修改Linux配置文件以允许在启动时自动挂载NFS文件系统。
sudo echo "options sunrpc tcp_slot_table_entries=128" >> /etc/modprobe.d/sunrpc.conf
sudo echo "options sunrpc tcp_max_slot_table_entries=128" >> /etc/modprobe.d/sunrpc.conf
建议您配置/etc/fstab文件,以便在启动时自动挂载NFS文件系统。您还可以配置“/etc/rc.local”文件以设置自动挂载。
配置自动装配。
如果在CentOS 6.x上配置自动挂载,请使用chkconfg netfs on命令使netfs服务在启动时运行。 |
file-system-id.region.nas.com:/ /mount-point nfs vers=4 0 0
file-system-id.region.nas.com:/ /mount-point nfs vers=3 0 0
在配置/etc/rc.local文件之前,请确保您对/etc/rc.local和/etc/rc.d/rc.local文件具有执行权限。例如,在CentOS 7.x上,默认情况下不授予用户执行权限。在配置/etc/rc.local文件之前,您必须将执行权限分配给用户。 |
sudo mount -t nfs -o vers=4 file-system-id.region.nas.com:/ /mount-point
sudo mount -t nfs -o vers=3 file-system-id-xxxx.region.nas.com:/ /mount-point
运行reboot linux实例。
使用mount-l命令查看挂载结果。
下图为成功挂载的示例。
挂载文件系统后,可以使用df-h命令查看文件系统的容量。