迷彩 潜伏 隐蔽 伪装
分类:
2012-09-08 08:12:01
原文地址:ESX中的Linux热添加磁盘 作者:szulrj2008
给VM新加了一个磁盘,不想重启VM又想认出这个磁盘怎么办呢?
可以用这个命令:
1 | echo "scsi add-single-device A B C D" >/proc/scsi/scsi |
1 2 3 4 | A : SCSI HBA ID B : SCSI Channel C : SCSI ID D : LUN ID |
就下图的设置命令可以写成这样:
1 | echo "scsi add-single-device 1 0 1 0" >/proc/scsi/scsi |
效果如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | [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 |
相反可以使用这个命令移除磁盘:
1 | echo "scsi remove-single-device A B C D" > /proc/scsi/scsi |
1 | fdisk /dev/sdb |
1 | mkfs.ext3 /dev/sbd1 (注:我这里是只分成一个区,所以只格式化sdb1) |
1 | /dev/sdb1 *** ext3 defaults,noatime 0 0 |