linux 配置autofs
Autofs與Mount/Umount的不同之處在於,它是一種看守程式。如果它檢測到使用者正試圖訪問一個尚未掛接的檔案系統,它就會自動檢測該檔案系
統,如果存在,那麼Autofs會自動將其掛接。另一方面,如果它檢測到某個已掛接的檔案系統在一段時間內沒有被使用,那麼Autofs會自動將其解除安裝。
因此一旦執行了Autofs後,使用者就不再需要手動完成檔案系統的掛接和解除安裝。
以下使用 RHEL7.0進行配置
[root@LiuZhen mnt]# service autofs start
Redirecting to /bin/systemctl start autofs.service
Failed to issue method call: Unit autofs.service failed to load: No such file or directory.
rpm沒有安裝,安裝autofsrpm
[root@LiuZhen mnt]# yum install autofs.x86_64
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package autofs.x86_64 1:5.0.7-40.el7 will be installed
--> Processing Dependency: libhesiod.so.0()(64bit) for package: 1:autofs-5.0.7-40.el7.x86_64
--> Running transaction check
---> Package hesiod.x86_64 0:3.2.1-3.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================
Installing:
autofs x86_64 1:5.0.7-40.el7 testyum 550 k
Installing for dependencies:
hesiod x86_64 3.2.1-3.el7 testyum 30 k
Transaction Summary
=========================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 579 k
Installed size: 3.6 M
Is this ok [y/d/N]: y
Downloading packages:
-------------------------------------------------------------------------------------------------------------------------
Total 1.1 MB/s | 579 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : hesiod-3.2.1-3.el7.x86_64 1/2
Installing : 1:autofs-5.0.7-40.el7.x86_64 2/2
Verifying : hesiod-3.2.1-3.el7.x86_64 1/2
Verifying : 1:autofs-5.0.7-40.el7.x86_64 2/2
Installed:
autofs.x86_64 1:5.0.7-40.el7
Dependency Installed:
hesiod.x86_64 0:3.2.1-3.el7
Complete!
[root@LiuZhen mnt]#
[root@LiuZhen mnt]#
[root@LiuZhen mnt]#
啟動服務
[root@LiuZhen mnt]# service autofs start
Redirecting to /bin/systemctl start autofs.service
[root@LiuZhen mnt]#
[root@LiuZhen mnt]#
設定開機自啟動
[root@LiuZhen mnt]# chkconfig autofs on
Note: Forwarding request to 'systemctl enable autofs.service'.
ln -s '/usr/lib/systemd/system/autofs.service' '/etc/systemd/system/multi-user.target.wants/autofs.service'
[root@LiuZhen cd]# grep -v ^$ /etc/auto.master | grep -v "#"
/misc /etc/auto.misc
/net -hosts
+dir:/etc/auto.master.d
+auto.master
檢視自動掛載的光碟
[root@LiuZhen cd]# ls /misc
cd
[root@LiuZhen cd]# ls /misc/cd
addons EULA images LiveOS Packages repodata RPM-GPG-KEY-redhat-release
EFI GPL isolinux media.repo release-notes RPM-GPG-KEY-redhat-beta TRANS.TBL
若檢視自動掛載的NFS使用以下命令
配置hosts
echo 172.16.7.1 nfsserver>> /etc/hosts
檢視自動掛載目錄
ls /net
ls /net/nfsserver
以下使用 RHEL7.0進行配置
[root@LiuZhen mnt]# service autofs start
Redirecting to /bin/systemctl start autofs.service
Failed to issue method call: Unit autofs.service failed to load: No such file or directory.
rpm沒有安裝,安裝autofsrpm
[root@LiuZhen mnt]# yum install autofs.x86_64
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package autofs.x86_64 1:5.0.7-40.el7 will be installed
--> Processing Dependency: libhesiod.so.0()(64bit) for package: 1:autofs-5.0.7-40.el7.x86_64
--> Running transaction check
---> Package hesiod.x86_64 0:3.2.1-3.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================
Installing:
autofs x86_64 1:5.0.7-40.el7 testyum 550 k
Installing for dependencies:
hesiod x86_64 3.2.1-3.el7 testyum 30 k
Transaction Summary
=========================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 579 k
Installed size: 3.6 M
Is this ok [y/d/N]: y
Downloading packages:
-------------------------------------------------------------------------------------------------------------------------
Total 1.1 MB/s | 579 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : hesiod-3.2.1-3.el7.x86_64 1/2
Installing : 1:autofs-5.0.7-40.el7.x86_64 2/2
Verifying : hesiod-3.2.1-3.el7.x86_64 1/2
Verifying : 1:autofs-5.0.7-40.el7.x86_64 2/2
Installed:
autofs.x86_64 1:5.0.7-40.el7
Dependency Installed:
hesiod.x86_64 0:3.2.1-3.el7
Complete!
[root@LiuZhen mnt]#
[root@LiuZhen mnt]#
[root@LiuZhen mnt]#
啟動服務
[root@LiuZhen mnt]# service autofs start
Redirecting to /bin/systemctl start autofs.service
[root@LiuZhen mnt]#
[root@LiuZhen mnt]#
設定開機自啟動
[root@LiuZhen mnt]# chkconfig autofs on
Note: Forwarding request to 'systemctl enable autofs.service'.
ln -s '/usr/lib/systemd/system/autofs.service' '/etc/systemd/system/multi-user.target.wants/autofs.service'
[root@LiuZhen cd]# grep -v ^$ /etc/auto.master | grep -v "#"
/misc /etc/auto.misc
/net -hosts
+dir:/etc/auto.master.d
+auto.master
檢視自動掛載的光碟
[root@LiuZhen cd]# ls /misc
cd
[root@LiuZhen cd]# ls /misc/cd
addons EULA images LiveOS Packages repodata RPM-GPG-KEY-redhat-release
EFI GPL isolinux media.repo release-notes RPM-GPG-KEY-redhat-beta TRANS.TBL
若檢視自動掛載的NFS使用以下命令
配置hosts
echo 172.16.7.1 nfsserver>> /etc/hosts
檢視自動掛載目錄
ls /net
ls /net/nfsserver
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27771627/viewspace-1241361/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- autofs
- 【Autofs】How to Configure Autofs on CentOS 7?CentOS
- 好用的Linux小工具:Autofs(轉)Linux
- Linux系統如何安裝AutoFs掛載服務Linux
- 如何使用 autofs 掛載 NFS 共享NFS
- NIS下solaris和linxu的client實現AutoFS(轉)client
- 【Linux學習筆記24-2】網路檔案系統 nfs + 自動掛解除安裝autofsLinux筆記NFS
- linux配置Linux
- linux配置sftpLinuxFTP
- linux配置jdkLinuxJDK
- linux 配置hostnameLinux
- 配置linux DNSLinuxDNS
- linux配置nginxLinuxNginx
- Linux安全配置Linux
- linux配置sudoLinux
- linux NFS 配置LinuxNFS
- linux VNC 配置LinuxVNC
- linux配置yumLinux
- Linux samba 配置LinuxSamba
- linux配置nfsLinuxNFS
- Linux DHCP 配置Linux
- linux rsh 配置Linux
- Linux 配置YUMLinux
- ubuntu linux配置UbuntuLinux
- 【Linux學習筆記24-1】網路檔案系統 samba共享設定 + 自動掛解除安裝 autofsLinux筆記Samba
- autofs服務動態自動掛載各種檔案系統(ZT)
- linux下配置javaLinuxJava
- Linux基礎配置Linux
- Linux|網路配置Linux
- linux 配置yum 源Linux
- linux 修改 dns 配置LinuxDNS
- [Linux] vsftpd配置LinuxFTP
- linux下配置zookeeperLinux
- Linux google host配置LinuxGo
- Linux配置notesLinux
- Linux環境配置Linux
- Linux 下配置 HugePagesLinux
- Linux中DNS配置LinuxDNS