Mount--linux mount Command detailed

Source: Internet
Author: User

in the Linux operating system, the Mount command is used to load the file system to the specified mount point. This command is most commonly used to mount CDROM so that we can access the data in CDROM, and when you insert a disc into CDROM, Linux does not mount automatically, and you must use the Linux mount command to manually complete the mount. Note here that the mount point must be a directory that already exists, this directory can not be empty, but the previous contents of the directory after the mount is not available, only after the Umount uninstall will return to normal, and only the directory can be mounted, the file can not be mounted, If the mount in a non-empty directory may cause system exceptions, it is recommended to mount in an empty directory. For frequently used devices, the file/etc/fastab can be written so that the system loads automatically at each boot. You can use the Umount command to uninstall the purge record in the/etc/mtab file of the Mount loading device's information record.

# # #用法: mount+ Mount source + mount point umount+ mount Source/mount point

---------------------------------------------------------------------------------------

# # #参数:

-R Read-only

-W read-write default

-F: This command is usually used with-a, which generates a stroke for each mount action. You can speed up the action of hanging when the system needs to hang a large number of NFS file systems.

-F: Usually used for debugging purposes. It makes mount not perform the actual hanging action, but rather simulates the entire hanging process. It is usually used with-V.

-V: Displays more messages, usually and-F for debugging.

-L: Split the hard drive with a specific label on it.

-U: The file system with the file segmentation sequence is hung down. The-L and-u must be meaningful when the/proc/partition file is present.

-T: Specifies the configuration of the file system, which is usually not required. Mount will automatically select the correct form.

-N: In general, Mount will write a piece of data in the/etc/mtab after it is hung. However, this option can be used to cancel this action if there is no writable file system in the system. in this case, using the Mount command with the DF command can not view the mount information, but the use of Proc/mounts view, note that the Linux operating system directly enter the Mount command, you can query the mounted information.

-A: Hang up all the file systems defined in the/etc/fstab, this operation can realize the requirements of automatic mount. When the/etc/fstab file is written, the mount operation can specify only the mount source or mount point, and the example shows

(1) We first put "/dev/sdb/app/testdisk ext4 defaults 0 0" Mount information into the "/etc/fstab" file, and view the system mount information, you can see that the/DEV/SDB did not complete the mount.

(2) Then we reboot the system and query the information again, this time we can see that the/DEV/SDB has been mounted.

(3) We now go back to the second step, we do not restart the system and then execute the following "mount-a" command, and then query the mount information, you will find that "/DEV/SDB" is again mounted.

From this we can conclude that, in fact, when the computer is turned on, it is equivalent to executing the "mount-a" command, which performs all the mount information in the "/etc/fstab" file all over again. And when the "/etc/fstab" file has mounted information, we can only enter the mount source or mount point in the system, then the system will automatically read the remaining information from the "/etc/fstab" file, and complete the mount, the operation is as follows

or enter

-B Directory mount directory, file mount file "DF" command cannot query but can be viewed with "df-a". We first create a new directory "test", before we know in the system if the Mount/app app/test operation, the system will be error, indicating that "/app" is not a block device, but we do "mount-b/app app/test" can be mounted successfully, such as the following


"DF" command not found, but with "df-a" can see,

But we can see from the figure that the mount source mounted on "/app/test" is the same as the "/app" mount Source, that is, it is not "/app" mounted on "app/test", but "/app" the Source "/dev/sda5" mounted in "/app/test" On

-O Async: Open non-synchronous mode, all file read and write actions will be performed in asynchronous mode. -o Async is the default setting

-O Sync: Executes in synchronous mode.

-O atime,-o noatime: When Atime is turned on, the "Last Call time" of the archive is updated each time the file is read. When we use the Flash file system, we may turn this option off to reduce the number of writes. -O atime is the default setting, example description, as follows

(1) We write the contents of the "Hello" file first, and then the "Touch Hello" to keep its timestamp consistent

(2) If we look at the "Hello" file, we can change its "atime", that is, as long as the access to "Atime" will be updated

(3) If we want to turn off "atime" access to Automatic Update, we can do "Mount-o noatime" when we mount it.

So we can find that when there is a visit, the "Atime" has always remained the same, so we closed the "ayime" time.

-O auto,-o Noauto: Turn on/off auto-hang mode. -o Auto is the default setting

-O Dev,-o nodev-o exec,-o noexec allow execution of the file. -O Dev is the default setting

-O suid,-o Nosuid: Indicates that the Suid,sgid permission in this directory is in effect/does not take effect. -o suid is the default setting

-O user,-o nouser: The user can perform mount/umount actions. -O Nouser is the default setting

-O remount: Put a file system that has been hung back in a different way. For example, a system that was originally read-only, is now re-hung in a read-write mode.

-O ro: Hang up with read-only mode.

-O RW: Hang up in read/write mode. As the default setting

-O loop=: Use loop mode to mount a file as a hard disk split system.

-O Defaults: Use the preset options rw, suid, dev, exec, auto, nouser, async, which is the default setting.

---------------------------------------------------------------------------------------

# # #findmnt

Findmnt Mount_point|device View mount condition, operate as follows

---------------------------------------------------------------------------------------

# # #卸载

Umount lifting the Mount command

Note that the device that the process is using cannot be uninstalled.

Lsof + mount point, view the program running on the specified mount point, display its process number kill + process number to end the specified process


After you've finished the process, you can execute the uninstall command.

fuser+ mount points can view and kill programs executed on Mount points

-V Detailed View

-m recursion, such as without m, to view only the mount point itself, without viewing subdirectories

-K End Process

-VMK combination options can be used together

here, the introduction of the Mount command is basically over, the mount command is generally relatively easy to accept and master, as long as the Mount command option is cleared, it will be very easy to mount and unload in Linux.

Mount--linux mount Command detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.