[Linux] mount device to directory using mount


In general, the direct mount device path directory path is OK. Umount device name, you can uninstall this device
Use lsblk – F to view the attached devices and their file systems.

[email protected]:/boot# lsblk -f
├─sda2 vfat SYSTEM_DRV B467-E8A8 
├─sda4 ntfs Windows8_OS 8A461C98461C875B /media/tao/Windows8_OS
├─sda5 ext4 e297ae56-7c17-48ea-aac5-f26c1e5cad84 /
├ - sda6 NTFS entertainment 7c387f10387ec8a2 / media / Tao / Entertainment
├ - sda7 NTFS office cc5a23c35a23a8e2 / media / Tao / Office
├ - sda8 NTFS software 4e8cef168ceef6fd / media / Tao / software
└─sda9 ntfs Lenovo_Recovery CE3C64723C64578B


This is my mobile hard disk, / dev / sdb1 is just a partition, which is attached to the / media / Tao / elements directory
└─sdb1 ntfs Elements 2A629C45629C17A1 /media/tao/Elements

When the directory is mounted, if there is file data in the mounted directory, the original data will disappear after the mount. Entering this directory will enter my mobile hard disk, and the original file will appear again after the uninstall.
The directory must exist at the time of mounting, and no error will be reported.
mount /dev/sdb1 /media/tao/Elements
umount /dev/sdb1

I mounted the ESP partition / dev / sda2 I had previously viewed to the directory / media / Tao / test, and then I could view its contents
mount /dev/sda2 /media/tao/test
umount /dev/sda2

In this file, / etc / fstab, the directory of auto mount is saved. Without it, the system cannot start. It mounts the partition of my Linux system to the root directory/
├─sda5 ext4 e297ae56-7c17-48ea-aac5-f26c1e5cad84 /

[email protected]:/boot# cat /etc/fstab
# /dev/sda5 LABEL=Basic\040data\040partition
UUID=e297ae56-7c17-48ea-aac5-f26c1e5cad84 / ext4 rw,relatime,data=ordered 0 1

/swapfile none swap defaults 0 0

Once when I was using Tencent cloud, I encountered this situation. I bought a cloud disk, then used the mount command to mount it to a directory, and modified / etc / fstab to mount it automatically. But one day, I forgot to renew the cloud disk service, and the cloud disk service will not be accessible. When the server is restarted, it can’t be started all the time, so I still need to ask the staff for the work order, and the troubleshooting will take a long time to solve.

Recommended Today

The use of progressbarcontrol, a progress bar control of devexpress – Taking ZedGraph as an example to add curve progress

scene WinForm control – devexpress18 download installation registration and use in vs: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100061243 When using ZedGraph to add curves, the number of curves is slower if there are many cases. So in the process of adding curve, the progress needs to be displayed, and the effect is as follows     Note: Blog home page:https://blog.csdn.net/badao_liumang_qizhi […]