Linux兩種光碟機自動掛載的方法
環境:CentOS6.4 西昆
方式一 修改fstab檔案
/etc/fstab是系統儲存檔案系統資訊?靜態檔案,每一行描述一個檔案系統;系統每次啟動會讀取此檔案資訊以確定需要掛載哪些檔案系統。引數語法不多說,網上很多
vi /etc/fstab
在最後新增一行
/dev/sr0 /Media/cdrom iso9660 defaults 0 0
方式二 配置autofs
此方式實際上是自動化的mount。就是說autofs一種守護程式,當檢測到使用者正師徒訪問一個尚未掛接的檔案系統,他就會進行檢測,如果存在且配置正確,那麼autofs會自動幫你掛載
1.安裝autofs
一般情況下預設安裝,rpm –qa | grep autofs確定
2.配置auto.master
autofs需要從/etc/auto.master檔案讀取配置資訊。主要用於指定檔案系統的掛接點,每一行表示一個掛接點;每一行由3部分組成
掛接點 掛接時用的配置檔案 自動解除安裝前的空閒時間
/mnt /etc/auto.misc --timeout 600
3.配置auto.misc
主要用於為auot.master提供掛接引數。同樣每一行表示一種檔案系統,每一行由3部分組成
cdrom -fstype=iso9660,ro,nosuid,nodev :/dev/sr0
相對?接點 檔案系統的掛接引數 檔案系統位置
4.啟動autofs
services autofs restart
5.使用autofs
上面的配置指定了每當需要讀取光碟機時,autofs會將光碟機掛載到/mnt/cdrom下。當空閒600秒後,autofs會自動解除安裝光碟機
一個簡單的測試
使用前檔案系統掛載情況
[root@CentOS6 /]# mount
/dev/mapper/vg_centos6-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
做一個使用光碟機的動作,比如進入/mnt/cdrom
[root@CentOS6 /]# cd /mnt/cdrom
[root@CentOS6 cdrom]#
再次檢視掛載
[root@CentOS6 cdrom]# mount
/dev/mapper/vg_centos6-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sr0 on /mnt/cdrom type iso9660 (ro,nosuid,nodev)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31516067/viewspace-2693282/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux光碟掛載Linux
- linux掛載新硬碟,開機自動掛載Linux硬碟
- oracle VM掛載光碟機Oracle
- CentOS系統開機自動掛載光碟機 和 fstab檔案詳解CentOS
- Linux下兩種自動啟動Tomcat的方法(轉)LinuxTomcat
- AIX 掛載及解除安裝光碟機、彈出光碟機AI
- Linux Linux作業系統中的目錄掛載到硬體(光碟機、光碟)中Linux作業系統
- linux上掛載光碟步驟Linux
- gentoo linux自動 掛載隨身碟 方法(zt)Linux
- AIX掛載光碟AI
- Linux硬碟分割槽及開機自動掛載Linux硬碟
- linux 自動掛載分割槽Linux
- solaris 10的自動掛載光碟的程式vold_假死如何處理
- parted和fdisk——兩種磁碟分割槽並掛載的方法
- debian掛載光碟機、軟碟機、usb(轉)
- C#程式實現軟體開機自動啟動的兩種常用方法C#
- linux 掛載光碟:mount: you must specify the filesystem typeLinux
- Linux磁碟分割槽及自動掛載Linux
- HP UNIX開機自動掛載與開機自動執行命令
- 讓機器開機自動掛載windows分割槽方法-fc3(轉)Windows
- 在fedora中掛載虛擬光碟機(燒錄機)(轉)
- 自動掛載 fstab
- 【AIX】AIX 開機自動掛載NFS共享AINFS
- RHEL6.2下掛載光碟機安裝軟體
- Linux(centos)手動掛載系統磁碟和自動掛載系統磁碟教程LinuxCentOS
- nfs掛載及開啟自動掛載NFS
- 『學了就忘』Linux基礎命令 — 38、Linux中光碟的掛載Linux
- [Windows][VC]開機自動啟動程式的幾種方法Windows
- MyEclipse SVN外掛的兩種安裝方法Eclipse
- Linux 掛載硬碟方法Linux硬碟
- 兩種動態建立表格的方法
- Win10系統下插入光碟機、隨身碟自動播放的禁止方法Win10
- Linux 下掛載硬碟的 方法Linux硬碟
- 指令碼實現U盤自動掛載(linux)指令碼Linux
- Linux安裝MySQL的兩種方法LinuxMySql
- 更改Linux時區的兩種方法Linux
- autofs服務動態自動掛載各種檔案系統(ZT)
- 下載GitHub上檔案的兩種方法Github