使用mount命令挂接某个物理设备后,必须用umount卸载它。
如果这个物理设备是个软盘或者活动硬盘,在没有umount的时候就移走了,系统向其写入的时候会出现问题。
这个问题可以通过Automounter解决。如果automounted的目录在特定的时间段内没有被访问或者使用,将会自动unmount.
Automounter 的后台进程daemon叫做 autofs.他可以自动mount一个目录,也可以经过一定时间后自动umount它。
相应的配置文件是/etc/auto.master 和 /etc/auto.misc
同时要保持/misc 目录为空,linux会在这个目录上配置 automounts。
1)
/etc/auto.master
将文件中以下语句的注释去掉:
#/misc /etc/auto.misc --timeout=60
/misc /etc/auto.misc --timeout=60
/misc 表示linux会在这个目录上配置 automounts。
/etc/auto.misc 在这个文件中进行详细配置。
--timeout=60,60秒。如果automounted的目录在60秒后没有被访问或者使用,将会自动unmount.
2)
/etc/auto.misc
有这么一行默认的设置:
cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
表示:
如果你有一个 CD 在 /dev/cdrom 驱动器中,可以通过Automounter自动mount,并且使用ls /misc/cd 直接访问cd中的内容(autofs服务启动后)。
/dev/cdrom 60秒后没有被访问或者使用,将会自动unmount.
步骤如下:
# service autofs restart
放入cd
# ls /misc/cd
/dev/cdrom被自动mount,可以看到cd的内容,并且
# mount 可以列出来被mount的 cdrom
/dev/cdrom on /misc/cd type iso9660(ro,nosuid,nodev)
60秒后再执行:
# mount
发现/dev/cdrom 已经不再列表中了,也就是被unmount 了
如果再
# ls /misc/cd
# mount
/dev/cdrom on /misc/cd type iso9660(ro,nosuid,nodev)
又被自动mount
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/3898/viewspace-789665/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/3898/viewspace-789665/