when using Linux , sometimes because the initial disk space allocation is not estimated, the use of the mount point needs to be expanded, this requires us to mount the new disk. But if we mount the disk while Linux is running, and Linux does not automatically recognize it without rebooting, then we need to use the following action to make Linux recognize the newly mounted disk without restarting it.
First, to view the host bus number, the disk must be connected by a bus:
[[Email protected]~]# ls/sys/class/scsi_host/
Host0 host1 Host2
Second, re-scan SCSI Bus to add devices:
[Email protected]~]# echo "---" >/sys/class/scsi_host/host0/scan
[Email protected]~]# echo "---" >/sys/class/scsi_host/host1/scan
[Email protected]~]# echo "---" >/sys/class/scsi_host/host2/scan
the reason for scanning is SCSI Bus because we are adding SCSI -type disks.
again, look at the newly mounted disk, Linux has been able to identify newly added disks:
[[Email protected]~]# fdisk-l
Finally, the newly mounted disks are partitioned, formatted, and mounted for use.
Add: scaling for mount points
Suppose we had a mount point for /data , at which time /data was full, but still wanted to add new data under/data, a soft link would be used to/data The soft link is attached to a newly mounted disk partition for capacity expansion. The specific steps are shown below.
(1) Create a directory to use as a mount point later:
[[Email protected]~]# mkdir/newdata
(2) mount the/DEV/SDB1 partition under/newdata:
[[Email protected]~]# mount/dev/sdb1/newdata
(3) Create a soft link from/data to /newdata:
[Email protected]~]# ln-s/newdata/data
at this point in the /data directory There will be a soft link file newdata point to/newdata/, that is, NewData, /newdata/ . This way, as long as we write to the/data/newdata file, the actual write to the /newdata/ directory, equivalent to the original /data mount point We added a new part of the use of space.
Note: we can also take advantage of this use of soft links to link larger log files to the mount point of a disk partition with ample storage space. For example, if the/opt/tomcat/logs/catalina.out log file is a lot of input, occupy a large space, and the/opt mount point is not much space left, there is an overflow risk, The log file can be soft-linked to another disk partition's mount point by following two steps:
[[Email protected]~]# touch/newdata/catalina_link.out
[[Email protected] ~] #ln-sf/newdata/catalina_link.out/opt/tomcat/logs/catalina.out
There are also three points to note , one must first create a linked file, otherwise the soft link fails, and the second is to force the soft link to empty before /opt/tomcat/logs/catalina.out the entire contents of the log file Third, the Tomcat directory needs to be restarted before it can continue writing to /opt/tomcat/logs/catalina.out .
This article is from the "barrel of fake dog excrement" blog, please be sure to keep this source http://xitongjiagoushi.blog.51cto.com/9975742/1629771
Learn a little more (vii)--Do not restart Linux add disk, use Soft link for mount point expansion