How to use Autofs to mount files in RHEL5

  

Autofs is an automount tool for mounting file systems. When you start Linux system, Autofs will also run automatically. The following small series will introduce you to RHEL5 using Autofs. The method of loading the file.

disk /dev /sdb with the mount autofs /data /abc directory.

Add a disk and reboot.

[root@localhost~]# reboot

To implement a trigger mount, you need to edit two files. Edit the /etc/auto.master file, you can refer to the system default trigger mount editing in the file. First write the parent directory of the mounted directory, /data and then write another file name to be edited. This file name is created by yourself. It is usually stored in the /etc directory. The file name is defined according to your needs.

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

/misc /etc/auto.misc

/mytest /etc/auto.mytest

Edit /etc/auto.mytest. This file does not exist and needs to be created by yourself. The format is first written to the subdirectory of the disk mount, just write the subdirectory file name, this subdirectory does not need to be created by itself. Followed by the file system type. Finally write: /dev/sdb, that is: plus the name of the mounted device.

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

abc -fstype=ext3 :/dev/sdb

View the /mytest file with no content , but continue to enter the abc directory to enter, then switch back to the /mytest directory to see the abc directory. By default, the system automatically uninstalls the directory if it does not operate for 300 seconds.

[root@localhostdata]# cd /mytest/

[root@localhostmytest]# ls

[root@localhostmytest]# cd abc

[ Root@localhostmytest]# ls

abc

The above is how RHEL5 uses Autofs to mount files. Once Autofs is run, the file system can be mounted and unloaded automatically. Start up automatically.

Copyright © Windows knowledge All Rights Reserved