标签:虚拟机 解释 centos 通过 end 现在 lun 查看 vendor
实验环境 一台运行Centos 7的虚拟机在线添加一块4G硬盘[关键命令]
添加:
echo "scsi add-single-device 1 2 3 4" >/proc/scsi/scsi
移除:
echo "scsi remove-single-device 1 2 3 4" > /proc/scsi/scsi
命令行解释:
命令行中的 1 2 3 4 需要自行修改成相应的参数:
1 : SCSI HBA ID
2 : SCSI Channel
3 : SCSI ID
4 : LUN ID
添加也可以使用 echo "- - -" > /sys/class/scsi_host/host2/scan
‘- - -‘代表channel,target和LUN编号。以上命令会导致host2下所有channel,target以及可见LUN被扫描
[root@localhost ~]# lsscsi
[1:0:0:0] cd/dvd NECVMWar VMware IDE CDR10 1.00 /dev/sr0
[2:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda
[root@localhost ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
[root@localhost ~]# ls /sys/class/scsi_host/
host0 host1 host2
#可以看到scsi硬盘使用的总线是host2
[root@localhost ~]# echo "- - -" > /sys/class/scsi_host/host2/scan
[root@localhost ~]# lsscsi
[1:0:0:0] cd/dvd NECVMWar VMware IDE CDR10 1.00 /dev/sr0
[2:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda
[2:0:1:0] disk VMware, VMware Virtual S 1.0 /dev/sdb
#或者使用 echo "scsi add-single-device 2 0 1 0" >/proc/scsi/scsi 也可以发现设备
[root@localhost ~]# lsblk /dev/sdb
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 4G 0 disk
[root@localhost ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 01 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
[root@localhost ~]# echo "scsi remove-single-device 2 0 1 0 " > /proc/scsi/scsi
[root@localhost ~]# lsscsi
[1:0:0:0] cd/dvd NECVMWar VMware IDE CDR10 1.00 /dev/sr0
[2:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda
[root@localhost ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
[root@localhost host2]# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sda3
标签:虚拟机 解释 centos 通过 end 现在 lun 查看 vendor
原文地址:https://blog.51cto.com/1012682/2360215