挂载
一、手动挂载
#mount 设备名 挂载点
例:将镜像光盘挂载到/mnt
#mount /dev/sr0 /mnt
二、开机自动挂载(永久挂载)
在/etc/fstab添加挂载信息
可以使用命令 先获取UUID
通过blkid查看UUID
#blkid
##可使用设备名,或UUID
#vim /etc/fstab
三、自动挂载
1.安装自动挂载的包
#yum install autofs -y
2.启动服务,关闭防火墙和SELINUX
#systemctl restart autofs
#vim /etc/auto.master
#vim /etc/auto.httpd
实例:给网页实现自动挂载
1.编辑http配置文件
#vim /etc/httpd/conf.d/vhosts.conf
编辑内容如下:
<VirtualHost 192.168.220.129:80>
DocumentRoot /public/test
ServerName 192.168.220.129
</VirtualHost>
<Directory /public/test>
AllowOverride none
Require all granted
Options +Indexes
</Directory>
2.开启服务创建资源文件,挂载(临时)
#mkdir -p /public/test
#echo this is a test > /public/test/index.html
#systemctl stop firewalld
#setenforce 0
#systemctl restart httpd
#mount /dev/sr0 /public/test
3.安装autofs,编辑配置文件
#yum install -y autofs
#systemctl restart autofs
#vim /etc/auto.master
#vim /etc/auto.httpd
重启autofs
#systemctl restart autofs
通过mount查看挂载情况
#mount | grep /dev/sr0
自动挂载成功