Today I learned about Linux mounting. This part is very simple. it involves two commands: mount and umount. First, let's talk about Mount. I will not talk about it in writing. you can use Baidu on your own. Simply put, in Linux, if we add a hard disk or partition, we cannot open it directly as in windows, but use an existing directory, by attaching the new hard disk or partition & ldquo; Mount & rdquo; to this directory, access our
Today I learned about Linux mounting. This part is very simple. it involves two commands: mount and umount.
First, let's talk about Mount. I will not talk about it in writing. you can use Baidu on your own. Simply put, in Linux, if we add a hard disk or partition, we cannot open it directly as in windows, but use an existing directory, by attaching the new hard disk or partition to this directory, you can access our new hard disk through this directory.
For example, we have a new hard disk. after it is inserted into the computer, we cannot see this hard disk when starting the system. we need to create a directory under the hard disk that we can see now, for example, if the path is yingpan and the path is/yingpan, after attaching the hard disk to the/yingpan Directory, the operation in the/yingpan directory is equivalent to the operation on the second hard disk.
1,
The mount command is
Usage: mount the partition mount point to be mounted.
For example, to mount the third partition of the first hard disk to our/mnt directory, you can write: mount/dev/sda3/mnt
There are several parameters:-t specifies the file system, and the above command can also be written as: mount-t ext4/dev/sda3/mnt
-O specified option: ro, read-only mounting
Rw, read/write mounting
Sync, do not use cache
Async, with cache mounting
Noatime: the access time is not updated during file access.
Atime: Update the access time when accessing files.
Remount, remount
Multiple parameters are separated by commas (,). For example
Mount-t ext4-o ro, sync, atime/dev/sda3/mnt
2,
After mounting, it is uninstalled. the unmounting is simple. This function is equivalent to the windows pop-up function.
Umount mount point or a specific partition
For example, the umount/dev/sda3 or umount/mnt commands have the same effect.
Sometimes the error "device is busy" may occur because a process is accessing the directory we want to uninstall. We can use the fuser-m mount point to check which processes are in use, or use the lsof mount point to check which file is in use.
3,
After mounting, we will find that the partition we just mounted has no more at next boot. at this time, we need to set automatic mounting to solve this problem.
Find the/etc/fstab file and use vi to edit it.
Add in the last line
File system mounting options dump and fsck (0 by default)
For example, you can add the following content:
/Dev/sda3/mnt ext4 defaults 0 0
At the next boot, we will find that our partitions will be automatically mounted.