ESX中的Linux热添加磁盘

      给VM新加了一个磁盘,不想重启VM又想认出这个磁盘怎么办呢?

      可以用这个命令:

echo "scsi add-single-device A B C D" >/proc/scsi/scsi

      参数 A、B、C、D 的内容是:

A : SCSI HBA ID
B : SCSI Channel
C : SCSI ID
D : LUN ID

      就下图的设置命令可以写成这样:

echo "scsi add-single-device 1 0 1 0" >/proc/scsi/scsi

image

      效果如下:

[root@rac02 ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0 
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0 
  Type:   Direct-Access                    ANSI SCSI revision: 02
[root@rac02 ~]# 
[root@rac02 ~]# 
[root@rac02 ~]# echo "scsi add-single-device 1 0 1 0" >/proc/scsi/scsi
[root@rac02 ~]# cat /proc/scsi/scsi                                   
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0 
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0 
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 01 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0 
  Type:   Direct-Access                    ANSI SCSI revision: 02

      相反可以使用这个命令移除磁盘:

echo "scsi remove-single-device A B C D" > /proc/scsi/scsi
posted @ 2011-02-11 17:33  killkill  阅读(1566)  评论(0编辑  收藏  举报