[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

Configure Apache to support PHP in the Apache main configuration file httpd.conf Include custom profile in

In Apache’s main configuration file / conf/ http.conf Add at the bottom Include “D:workspace_phpapache-php.conf” The file path can be any In D: workspace_ Create under PHP file apache- php.conf file Its specific content is [html] view plain copy PHP-Module setup LoadFile “D:/xampp/php/php5ts.dll” LoadModule php5_module “D:/xampp/php/php5apache2_2.dll” <FilesMatch “.php$”> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch “.phps$”> SetHandler application/x-httpd-php-source </FilesMatch> […]