给VM新加了一个磁盘,不想重启VM又想认出这个磁盘怎么办呢?
可以用这个命令:
1echo"scsi add-single-device A B C D">/proc/scsi/scsi 1234A : SCSI HBA IDB : SCSI ChannelC : SCSI IDD : LUN ID就下图的设置命令可以写成这样:
?1echo"scsi add-single-device 1 0 1 0">/proc/scsi/scsi效果如下:
?12345678910111213141516171819202122[root@rac02 ~]# cat /proc/scsi/scsiAttached devices:Host: scsi0 Channel: 00 Id: 00 Lun: 00Vendor: VMware Model: Virtual disk Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 02Host: scsi1 Channel: 00 Id: 00 Lun: 00Vendor: 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: 00Vendor: VMware Model: Virtual disk Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 02Host: scsi1 Channel: 00 Id: 00 Lun: 00Vendor: VMware Model: Virtual disk Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 02Host: scsi1 Channel: 00 Id: 01 Lun: 00Vendor: VMware Model: Virtual disk Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 02相反可以使用这个命令移除磁盘:
?1echo "scsi remove-single-device A B C D" > /proc/scsi/scsi 添加成功后,使用命令分区挂载 1fdisk /dev/sdb 按 n 按照提示输入1-4分区,接着一路回车,最后输入w保存退出; 再格式化 1mkfs.ext3 /dev/sbd1 (注:我这里是只分成一个区,所以只格式化sdb1) 接着在根目录下新建一个文件夹来挂载,或者挂载到现有目录下 mount -t ext3 /dev/sdb1 *** 最后修改/etc/fstab ,添加开启自动挂载 1/dev/sdb1 *** ext3 defaults,noatime 0 0