Mount is mounted. mounty11 is not mounted successfully.
Mount
1 mount
Basic Concepts
Mount: Associate the additional file system with the existing Directory of the root file system, so that this directory is used as the behavior for accessing other files to the database.
Unmount: The process of disassociation
Note: The original files under the mount point will be temporarily hidden after the mount is completed, but the data will not be lost. Therefore, the Mount directory should be empty.
2 Mount Method
mount DEVICE MOUNT_POINT
DEVICE is the DEVICE to be mounted. It can be a disk partition, a LABEL, a UUID, or a file (which can also be used as a disk after file formatting). MOUNT_POINT is the mount point.
For example:
[Root @ local ~] # Mount/dev/sdc1/mnt/sdc1 [root @ local ~] # Mount-U "95c37ae8-7bd9-4d8b-ba17-61aaf39f292f"/mnt/sdc1 [root @ local ~] # Mount-L "SDC1"/mnt/sdc1/# SDC1 bit partition? Dev/sdc1.
You can mount the/dev/sdc1 partition to the/dev/sdc1 directory in the preceding three methods. Now you can access the/dev/sdc1 disk in the/mnt/sdc1 directory, all data operations on/mnt/sdc1 are saved to the/dev/sdc1 partition.
Before mounting, you must create a file system, that is, format the partition.
3. View mounting commands
Df, lsblk, or cat/proc/mounts
You can run the df command to display the current and mounted devices.
[Root @ local ~] # DfFilesystem 1K-blocks Used Available Use % Mounted on/dev/sda2 12254344 6357184 5251632 55%/devtmpfs 1001592 0 1001592 0%/devtmpfs 1016064 88 1015976 1%/dev/shmtmpfs 1016064 9292 1006772/runtmpfs 1% 0 1016064 0%/sys/fs/cgroup/dev/sda1 194235 123782 56117 69%/boottmpfs 203216 16 203200 1%/run/user/0/dev/sr0 8086368 8086368 0 100%/run/ media/root/CentOS 7 x86_64/dev/sdc1 1998672 6144 1871288 1%/mnt/sdc1 # You can see that the partition has been mounted successfully.
[root@local ~]# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTfd0 2:0 1 4K 0 disksda 8:0 0 20G 0 disk├─sda1 8:1 0 200M 0 part /boot├─sda2 8:2 0 12G 0 part /└─sda3 8:3 0 1G 0 part [SWAP]sdb 8:16 0 5G 0 disk├─sdb1 8:17 0 976M 0 part├─sdb2 8:18 0 975.6M 0 part└─sdb3 8:19 0 975M 0 partsdc 8:32 0 5G 0 disk└─sdc1 8:33 0 2G 0 part /mnt/sdc1sr0 11:0 1 7.7G 0 rom
[root@local ~]# cat /proc/mountsrootfs / rootfs rw 0 0sysfs /sys sysfs rw,seclabel,nosuid,nodev,noexec,relatime 0 0proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0devtmpfs /dev devtmpfs rw,seclabel,nosuid,size=1001592k,nr_inodes=250398,mode=755 0 0securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev 0 0[. . . . .]tmpfs /run/user/0 tmpfs rw,seclabel,nosuid,nodev,relatime,size=203216k,mode=700 0 0/dev/sdc1 /mnt/sdc1 ext4 rw,seclabel,relatime,data=ordered 0 0
4 mount common Command Options
-T vsftype: Specifies the file system type on the device to be mounted.
-R: readonly, read-only mounting
-W: read and write, read/write mounting
-N: Do not update/etc/mtab, mount is invisible, that is, the mount command does not see the mounted successfully
-A: automatically mount all devices that support automatic mounting (specified in the/etc/fstab file, and the mounting option has the auto function)
-L "LABEL": Specify the mounting device as the volume LABEL
-U "UUID": Specify the device to be mounted with UUID
-B, -- bind: bind the directory to another directory.
-O option: Specifies the option for mounting a file system. Multiple options are separated by commas. Is a magic option.
Async: One-Step mounting
Sync: Synchronous mounting
Atime/noatime: Disable or enable automatic updates to atime, including directories and files
Diratime/nodiratime: Directory Access Timestamp
Auto/noauto: whether automatic mounting and-a are supported
Exec/noexec: whether to support running applications on the file system
Dev/nodev: whether to support using device files on the next File System
Suid/nosuid: whether suid and sgid permissions are supported
Remount: remount
Ro: Read-Only mounting
Rw: read/write mounting
User/nouser: whether to attach the device to an ordinary user. The default administrator can attach the device.
Acl: Enable the acl function on the file system.
Default: equivalent to re, nosuid, dev, exec, auto, nouser, async
5 Other Mount-related commands
(1) view the mounting status of the mount point: findmnt MOUNT_POINT
[root@local ~]# findmnt /mnt/sdc1TARGET SOURCE FSTYPE OPTIONS/mnt/sdc1 /dev/sdc1 ext4 rw,relatime,seclabel,data=ordered[root@local ~]# findmnt /mnt/sdc2TARGET SOURCE FSTYPE OPTIONS/mnt/sdc2 /dev/sdc2 xfs rw,relatime,seclabel,attr2,inode64,noquota
(2) view the processes that are accessing the specified file system:
Lsof MOUNT_POINT, fuser-v MOTN_POINT
[root@local ~]# lsof /mnt/sdc1COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEbash 1615 root cwd DIR 8,33 4096 2 /mnt/sdc1bash 2024 root cwd DIR 8,33 4096 2 /mnt/sdc1
Two users are accessing the/mnt/sdc1 directory.
[root@local ~]# fuser -v /mnt/sdc1USER PID ACCESS COMMAND/mnt/sdc1: root kernel mount /mnt/sdc1root 1615 ..c.. bashroot 2024 ..c.. bash
(3) terminate all processes that are accessing the specified file system
[root@local ~]# fuser -km /mnt/sdc1/mnt/sdc1: 1615c 2024c
Next, check whether the operation is successful.
[root@local ~]# lsof /mnt/sdc1
You can see and play successfully, but it is best to send a notification in advance in actual use, so as to avoid the loss of online data import.
6 uninstall
Uninstall command: umount DEVICE
Or umount MOUNT_POINT
[Root @ local ~] # Umount/dev/sdc1 # uninstall/dev/sdc1
If you cannot see/dev/sdc1, the uninstall is successful.
[root@local ~]# dfFilesystem 1K-blocks Used Available Use% Mounted on/dev/sda2 12254344 6869184 4739632 60% /devtmpfs 1001592 0 1001592 0% /devtmpfs 1016064 84 1015980 1% /dev/shmtmpfs 1016064 9232 1006832 1% /runtmpfs 1016064 0 1016064 0% /sys/fs/cgroup/dev/sda1 194235 123782 56117 69% /boottmpfs 203216 16 203200 1% /run/user/42tmpfs 203216 0 203216 0% /run/user/0/dev/sdc2 1038336 32944 1005392 4% /mnt/sdc2
Use another method to uninstall/dev/sdc2.
[root@local ~]# umount /mnt/sdc2[root@local ~]# dfFilesystem 1K-blocks Used Available Use% Mounted on/dev/sda2 12254344 6869184 4739632 60% /devtmpfs 1001592 0 1001592 0% /devtmpfs 1016064 84 1015980 1% /dev/shmtmpfs 1016064 9232 1006832 1% /runtmpfs 1016064 0 1016064 0% /sys/fs/cgroup/dev/sda1 194235 123782 56117 69% /boottmpfs 203216 16 203200 1% /run/user/42tmpfs 203216 0 203216 0% /run/user/0
And/dev/sdc2 not visible, indicating that the unmount is successful.
7. Modify the/etc/fstab file and set automatic mounting.
View the/etc/fstab file
[root@local ~]# cat /etc/fstab## /etc/fstab# Created by anaconda on Sun Apr 16 10:18:50 2017## Accessible filesystems, by reference, are maintained under '/dev/disk'# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info#UUID=dddd23d1-1012-4bac-9717-56b9b469e0c2 / ext4 defaults 1 1UUID=316d8677-25b8-49af-b4eb-54daa20b6595 /boot ext4 defaults 1 2UUID=dacd6ddd-d765-4646-b98c-0579f2732749 swap swap defaults 0 0
You can see that each row defines a file system to be mounted. There are six fields, each of which has the following meanings:
The first field is the device or pseudo file system to be mounted.
Device File, volume LABEL, UUID, pseudo file system name (proc, sysfs)
Second Field: Specify the mount point
Third Field: File System Type
Fourth field: Mount Option
Sync, atime/noatime, diratime/nodiratime, auto/noauto, exec/noexec, dev/nodev, suid/nosuid,
Remount, ro, rw, user/nouser, acl
Fifth field: memory transfer frequency
0: No backup
1: daily transfer
2: no memory transfer every other day
Sixth field: self-check order at startup
0: indicates no self-check
1: first self-check. Generally, only rootfs can use 1.