服务器或者虚拟机空间不足,添加硬盘后可以不用重启就找到吗?
结果是肯定的
1、在开机状态下新增磁盘
2、执行下面的命令
[root@test1 scsi]# echo "- - -" > /sys/class/scsi_host/host0/scan
特别注意
“- - -” 这三个-之间是有空格的;
假如 fdisk -l 还是未发现新硬盘,则将上面命令中的host0,替换为host1,host2,….
3、我们再查看系统日志/var/log/messages,发现对SCSI设备进行了一次重新扫描
[root@test1 host0]# cat /var/log/messages Jun 29 11:00:38 test1 kernel: scsi 0:0:2:0: Direct-Access VMware, VMware Virtual S 1.0 PQ: 0 ANSI: 2 Jun 29 11:00:38 test1 kernel: scsi target0:0:2: Beginning Domain Validation Jun 29 11:00:38 test1 kernel: scsi target0:0:2: Domain Validation skipping write tests Jun 29 11:00:38 test1 kernel: scsi target0:0:2: Ending Domain Validation Jun 29 11:00:38 test1 kernel: scsi target0:0:2: FAST-40 WIDE SCSI 80.0 MB/s ST (25 ns, offset 127) Jun 29 11:00:38 test1 kernel: sd 0:0:2:0: Attached scsi generic sg3 type 0 Jun 29 11:00:38 test1 kernel: sd 0:0:2:0: [sdc] 10485760 512-byte logical blocks: (5.36 GB/5.00 GiB) Jun 29 11:00:38 test1 kernel: sd 0:0:2:0: [sdc] Write Protect is off Jun 29 11:00:38 test1 kernel: sd 0:0:2:0: [sdc] Cache data unavailable Jun 29 11:00:38 test1 kernel: sd 0:0:2:0: [sdc] Assuming drive cache: write through Jun 29 11:00:38 test1 kernel: sd 0:0:2:0: [sdc] Attached SCSI disk Jun 29 11:00:38 test1 dbus[8622]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' Jun 29 11:00:38 test1 systemd: Starting Hostname Service... Jun 29 11:00:39 test1 dbus[8622]: [system] Successfully activated service 'org.freedesktop.hostname1' Jun 29 11:00:39 test1 systemd: Started Hostname Service. Jun 29 11:01:01 test1 systemd: Started Session 125 of user root.
用fdisk -l也看到了新增加的磁盘了。上面的命令主要的目的就是scan the SCSI bus