Operation and maintenance
Mounting of the file system in Linux (CentOS7) (take mounting image files as an example)
Experimental environment: Operating system: CentOS7
1. Manual mounting
1. First create a new directory in the current directory (you can use the pwd command to view the current Directory)
mkdir /c1
2. Mount the CD-ROM drive
mount [option] [device] [mount point]
For example: mount -r /dev/sr0 /c1 //r is to mount the complete code in read-only mode
:
[root@localhost ~]# mkdir /c1
[root@localhost ~]# mount -r /dev/sr0 /mnt
[root@localhost ~]# mount -a
[root@localhost ~]# df
文件系统 1K-块 已用 可用 已用% 挂载点
devtmpfs 480796 0 480796 0% /dev
tmpfs 497852 0 497852 0% /dev/shm
tmpfs 497852 8740 489112 2% /run
tmpfs 497852 0 497852 0% /sys/fs/cgroup
/dev/mapper/centos-root 17811456 5453996 12357460 31% /
/dev/sda1 1038336 175208 863128 17% /boot
tmpfs 99572 44 99528 1% /run/user/0
/dev/sr0 4669162 4669162 0 100% /mnt
2. Auto mount (auto mount when the system starts)
1. First create a new directory
mkdir /c2 in the current directory
2. Mount the CD-ROM drive
Edit the /etc/fstab file
vim /etc/fstab
in the last line of the file Enter the following command
/dev/sr0 /c2 iso9660 defaults 0 0,
use the mount -a command to refresh and use the df command to view it. It
can be seen that the complete code is successfully mounted in a read-only manner
:
[root@localhost ~]# mkdir /c2
[root@localhost ~]# vim /etc/fstab
//在文件最后一行加入:/dev/sr0 /c2 iso9660 defaults 0 0
[root@localhost ~]# mount -a
[root@localhost ~]# df
文件系统 1K-块 已用 可用 已用% 挂载点
devtmpfs 480796 0 480796 0% /dev
tmpfs 497852 0 497852 0% /dev/shm
tmpfs 497852 8740 489112 2% /run
tmpfs 497852 0 497852 0% /sys/fs/cgroup
/dev/mapper/centos-root 17811456 5453136 12358320 31% /
/dev/sda1 1038336 175208 863128 17% /boot
tmpfs 99572 44 99528 1% /run/user/0
/dev/sr0 4669162 4669162 0 100% /c2
That's it for today's sharing. If you have any questions, comment directly, and the blogger will definitely reply.