nescafeboy1 发表于 2018-5-14 10:03:21

Redhat9设置光盘自动挂载

使用autofs软件包可以实现外接设备(光盘、分区、硬盘)等的自动挂载。
1、主配置文件:/etc/auto.master
其格式:
挂载目录      映射文件            参数
/misc         /etc/auto.misc      -timeout=60
2、映射文件/etc/auto.misc的格式:
关键字      挂载选项                  设备
cd            -fstype-iso9660,ro      :/dev/cdroom
fd            -fstype=auto            :/dev/fd0
设备如果是本地的,必须加冒号。
3、具体示例:设置自动挂载光盘。
(1)确认安装了autofs软件包:
   #rpm -q autofs
(2)编辑主配置文件:
   #vi /etc/auto.maser

   按照上面说的格式,添加一行:
   /misc /etc/auto.misc--timeout=60
   已经有的就将前面的注释#号删掉
(3)编辑映射文件
   #vi /etc/auto.misc
   添加一行:
   cd   -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
   已经有的就将前面的注释#号删掉
(4)重启autofs
    #service autofs restart
(5)验证
    #ls /misc/cd
4、将autofs设成开机服务:
   #chkconfig --list autofs
   #chkconfig autofs on
5、OK
6、如果设立链接
#ln -s /misc/cd /cd
更直观,更易访问。
页: [1]
查看完整版本: Redhat9设置光盘自动挂载