虚拟机新增硬盘,如何让Linux系统识别到

2025-04-25 00:50:12
推荐回答(1个)
回答1:

1、重启系统(不用动脑就搞定)
有人说,我比较懒,不想动脑,那么这种方法(重启系统,一切搞定)很适合你。

那么,万一要是此Linux系统有业务正在运行,而又不能重启呢?咋办,这时就要动手+动脑了。

出绝招了,请看下面方法。

2、执行命令,重新scan设备
#先cd到/sys/class/scsi_host/目录
[root@ilinux /]# cd /sys/class/scsi_host/

#我们来看看scsi_host目录有啥东西呢,这里有三个子目录哦
[root@ilinux scsi_host]# ls
host0 host1 host2

#执行如下命令
[root@ilinux scsi_host]# echo "- - -" > host0/scan
注意:“- - -”这三个“-”中间有空格滴。

#用fdisk命令来查看下吧
[root@ilinux scsi_host]# fdisk -l

#如果还是没有识别到,别着急,go on;

[root@ilinux scsi_host]# echo "- - -" > host1/scan
[root@ilinux scsi_host]# echo "- - -" > host2/scan
#我们再分别执行下上面host1和host2的命令,再fdisk下吧! [root@ilinux scsi_host]# fdisk -l
Disk /dev/sda: 171.8 GB, 171798691840 bytes
255 heads, 63 sectors/track, 20886 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d1499
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 281 2048000 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 281 20887 165518336 83 Linux

Disk /dev/sdb: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000