automount 配置

来源:互联网 发布:java pow方法 编辑:程序博客网 时间:2024/04/30 18:11

将挂载添加到automount服务


nfs示例:
服务器192.168.0.100已经建立了/opt的nfs服务,在客户机设置automount的步骤如下:
1.确定挂载点的位置,假设挂载到/opt/share/nfs下


2.创建配置文件,名字可以任意取,习惯性的名字是auto.*,放到/etc下,内容如下:
#mount-point(/opt/share/nfs的相对路径)        option            server ip:path
nfs            -onosuid,hard,timeo=5,retry=60,intr                192.168.0.100:/opt

#相当于命令行:
#mount -onosuid,hard,timeo=5,retry=60,intr 192.168.0.100:/opt /opt/share/nfs


3.将2中创建的atuo.*文件加入到/etc/auto.master中:
/opt/share   /etc/auto.*

#注意:将auto.*替换为实际的文件名


4.重启automount服务:
/etc/init.d/autofs restart


5.进入到/opt/share目录,ls后看不到nfs目录,这是正常现象,cd nfs是可以进入的,这个目录是自动检测的
当有访问时才自动挂载,长时间不访问会自动umount



samba示例:
主要步骤同nfs设置,option和server ip/path有些区别,格式如下
199     -fstype=cifs,username=adfs_wx,password=///123                           ://192.168.0.199/wx

原创粉丝点击