Linux: how to mount and detach device commands

Source: Internet
Author: User

Mount and detach

Everything in Linux is a file, and all the devices you want to use are directly mounted to the Linux kernel.
Directly detach from the kernel, which can reduce the work of the kernel and effectively improve the work efficiency.

As mentioned above, when the partition is complete, you need to mount the required partition before using it.
Next we will introduce several commands for mounting partitions:

 

 

mount:
Mount-T [fstype] [Options] device mount_point specifies the file system type for the mounted file system.
-r indicates that the mounted file can only be read.
- W indicates writable
-N indicates whether to attach to a directory
-O specifies the option for mounting, default Value: Defaults
-A: automatically mounts all file systems, and automatically mounts the file system when the system is restarted
Mount-O remount, RW/dev/sda5 re-mount/sda5 under/dev
async asynchronous write, indicates that the data is cached in the memory and then written to the hard disk at the time of writing.
noatime does not update the access time of the accessed file. This will be used later.
Exec: whether to execute the binary file noexec to prohibit execution, virus prevention

You can also directly modify/etc/fstab.
This section describes the six fields.
First: the device to be mounted:/dev/sda5, label = volume label, or UUID = ""
Second: mount point: for example,/mnt/mydata
Third: file system type: for example, ext3
Fourth: Mount Option: if multiple options are available, use commas to separate the options.

 
Devpts/dev/PTS devpts gid = 5, mode = 620 0 0 sysfs/sys sysfs ults

For example: defaults, ACL [indicates the access control list]
Fifth: dumping frequency. 0 indicates no backup, 1 indicates daily backup, and 2 indicates backup every day.
Sixth: file system self-check order: from 0 to 9
0 indicates no self-check
1 indicates self-check after startup. Only the root value is 1 and only the root user can perform self-check first.

You can take a look at the content of this file. CAT/etc/fstab

Fuser: You can view who is using this device.

Fuser-V/mydata [mount point] to check which user is using this device
Fuser-km/mydata can directly remove users using this device, so that you can easily Uninstall this device
Otherwise, it will always show that the device is busy and cannot be detached

Umount device name or change the device's mount point to uninstall the device

 

The above commands should be mastered, which will be of great help to implement soft raid in the future.
Commands including disk management are also basic for implementing the soft RAID 0 RAID 1 RAID 5 raid 10 in the future.

 

 

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.