mount 文件挂载

mount 外部挂载,

#创建一个20M的文件
[yuq@localhost test]$ dd if=/dev/zero of=file1 bs=1M count=20
记录了20+0 的读入
记录了20+0 的写出
20971520字节(21 MB)已复制,0.0879939 秒,238 MB/秒
[yuq@localhost test]$ ls -l


#图形化界面创建分区:应用程序->工具->磁盘

#查看文件大小
[yuq@localhost test]$ ls -lh
总用量 20M
-rw-rw-r--. 1 yuq yuq 20M 6月 13 19:46 file1

#复制文件到当前目录
[yuq@localhost test]$ cp /etc/hosts /etc/passwd /etc/services .
[yuq@localhost test]$ ls
file1 hosts passwd services

挂载:mount /dev/sda3 /aa/
卸载:unmount /aa/

#挂载只读文件系统
[root@localhost yuq]# mount -o ro /dev/sda2 /aa

#noexec:挂载的文件不能执行
[root@localhost yuq]# mount -o noexec /dev/sda6 /aa

#重新挂载(有执行权限)
[root@localhost yuq]# mount -o remount,exec /aa/

#开机自动挂载
[root@localhost yuq]# cat /etc/fstab
#1外部设备 2挂载点 3文件系统 4默认,ro(只读),noexec(不可以写) 50 60
/dev/mapper/rhel-swap swap swap defaults 0 0

#查看所有的挂载
[root@localhost yuq]# df -hT
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/mapper/rhel-root 18307072 7100184 11206888 39% /
devtmpfs 928872 0 928872 0% /dev
tmpfs 938844 80 938764 1% /dev/shm
tmpfs 938844 8980 929864 1% /run
tmpfs 938844 0 938844 0% /sys/fs/cgroup
/dev/sda1 508588 126952 381636 25% /boot

原文地址:https://www.cnblogs.com/ytb-wpq/p/7003398.html