本文将介绍CentOS上新增磁盘后,在不重启服务器的情况下如何让系统识别磁盘。

直接运行如下指令:

1
echo "- - -" > /sys/class/scsi_host/host0/scan

即可识别新增加的硬盘

以下是实操例子:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
[root@file-15 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@file-15 ~]# fdisk -l
Disk /dev/sda: 1017.6 GB, 1017604210688 bytes
255 heads, 63 sectors/track, 123716 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        6527    52323705   8e  Linux LVM
/dev/sda3            6528      123716   941320642+  8e  Linux LVM
Disk /dev/sdb: 1099.5 GB, 1099511626752 bytes
255 heads, 63 sectors/track, 133674 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
[root@file-15 ~]#