# # /etc/fstab # Created by anaconda on Tue May 2 07:21:59 2017 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/cl-root/ xfs defaults 00 UUID=fc90e3db-ce52-43d0-ac08-6b8ca4dc25ab /boot xfs defaults 00 /dev/mapper/cl-swap swap swap defaults 00 192.168.50.156:/opt/mnt nfs defaults 00
[root@node-server-1 nfs]# cat /etc/auto.nfs # # This is an automounter map and it has the following format # key [ -mount-options-separated-by-comma ] location # Details may be found in the autofs(5) manpage
[root@node-server-1 nfs]# cd /nfs/ [root@node-server-1 nfs]# ls
5.然后,我们 cd nfs 看下,发现就有了,至此,实现了 nfs 的自动挂载。
[root@node-server-1 nfs]# cd nfs [root@node-server-1 nfs]# ls 2017-04-10-raspbian-jessie-lite.img 2017-04-10-raspbian-jessie-lite.zip CentOS-6.8-x86_64-bin-DVD1.iso CentOS-7-x86_64-DVD-1611.iso cn_windows_7_ultimate_with_sp1_x86_dvd_u_677486.iso linux-4.10.14 linux-4.10.14.tar.xz natap.log rh ubuntu-16.04.2-server-amd64.iso ubuntu-16.04-preinstalled-server-armhf+raspi3.img win1064.iso WOL
6.设置超时时间,当超时后自动断开
[root@node-server-1 yum.repos.d]# cat /etc/sysconfig/autofs # # Init syatem options # # If the kernel supports using the autofs miscellanous device # and you wish to use it you must set this configuration option # to "yes" otherwise it will not be used. # USE_MISC_DEVICE="yes" # # Use OPTIONS to add automount(8) command line options that # will be used when the daemon is started. # #OPTIONS="" TIMEOUT=300 #