首页 > 其他 > 详细

浅谈autofs触发挂载

时间:2014-02-24 19:22:14      阅读:681      评论:0      收藏:0      [点我收藏+]

 autofs触发挂载简单说就是在用户在需要某些资源的时候会自动加载,这一点在资源通过网络文件系统(NFS)访问的服务器之间尤为方便。今天用示例给大家简单介绍一下autofs触发挂载是如何实现的

1,先查看一下自己的机子有没有安装触发挂载工具,如果没有安装请通过搭建yum库或者其他方法安装autofs工具

[root@localhost ~]# rpm -q autofs

autofs-5.0.1-0.rc2.177.el5……已安装

2,用vim编辑/etc/auto.master,添加自动触发挂载配置

[root@localhost~]# vim /etc/auto.master

#

# $Id:auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $

#

# Sampleauto.master file

# This is anautomounter map and it has the following format

# key [-mount-options-separated-by-comma ] location

# For details ofthe format look at autofs(5).

#

/misc   /etc/auto.misc

/data   /etc/auto.file……追加一行  /data 挂载点父目录

                                   /etc/auto.file 挂载配置文件(自定义)

#

# NOTE: mountsdone from a hosts map will be mounted with the

#       "nosuid" and "nodev"options unless the "suid" and "dev"

#       options are explicitly given.

#

/net    -hosts

#

# Includecentral master map if it can be found using

# nsswitchsources.

#

# Note that ifthere are entries for /net or /misc (as

# above) in theincluded master map any keys that are the

# same will notbe seen as the first read key seen takes

-- INSERT--                                                 10,23         Top

3vim创建并且编辑挂载配置文件

[root@localhost~]# vim /etc/auto.file


file  -fstype=ext3  :/dev/sda5   ……file 挂载点子目录(无需创建)

                                    fstype=ext3 挂载参数

                                    :/dev/sad5 挂载设备名

~                                                                              

                                                            1,28          All

4,开启autofs服务

[root@localhost data]# service autofs restart  …….重新开启服务

Stopping automount:                                        [  OK  ]

Starting automount:                                        [  OK  ]

[root@localhost data]#

5,验证配置正确性

[root@localhost ~]# cd /data/

[root@localhost data]# ls

[root@localhost data]#  ……没有目录

[root@localhost data]# cd file

[root@localhost file]#   ……挂载成功


[root@localhost file]# df -lT

Filesystem   Type   1K-blocks      Used Available Use% Mounted on

/dev/sda2    ext3    20315844   2444060 16823144  13% /

/dev/sda1    ext3      101086     12200    83667  13% /boot

tmpfs       tmpfs      511920         0   511920   0% /dev/shm

/dev/sda5     ext3    9621848    152688   8980384  2%/data/file


本文出自 “沙漏” 博客,请务必保留此出处http://1570880775.blog.51cto.com/3105756/1362304

浅谈autofs触发挂载

原文:http://1570880775.blog.51cto.com/3105756/1362304

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!