首页 > 系统 > CentOS > 正文

CentOS学习笔记--SCSI 设备热插拔

2024-06-28 13:21:38
字体:
来源:转载
供稿:网友
CentOS学习笔记--SCSI 设备热插拔CentOS学习笔记--SCSI 设备热插拔

处于运行中的服务器,因业务要求也许不允许重启机器,而新添加的SCSI设备(主要是硬盘)如何实现热插拔呢?

首先需要查看一下设备:

#cat /PRoc/scsi/scsiAttached devices:Host: scsi1 Channel: 00 Id: 00 Lun: 00  Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00  Type:   CD-ROM                           ANSI  SCSI revision: 05Host: scsi2 Channel: 00 Id: 00 Lun: 00  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0   Type:   Direct-access                    ANSI  SCSI revision: 02

可以看到有两种设备:CD-ROM 和 Direct-Access 。

清楚SCSI设备后,就可以重新扫描新的设备了(例子是添加SCSI硬盘):

# echo "scsi add-single-device 2 0 1 0" >/proc/scsi/scsi  echo "scsi add-single-device a b c d" >/proc/scsi/scsi中  a 表示 SCSI的设备号,上面的Host:scsi后的数字,新添加就是同类型的那个数字,虚拟机中的scsi硬盘就是Direct-Access  b 表示 CHANNEL号,上面的channel,基本都是0  c 表示 ID号,新添加就是上面同类型的Id值+1  d 是LUN号 一般都为0
查看一下:
# cat /proc/scsi/scsiAttached devices:Host: scsi1 Channel: 00 Id: 00 Lun: 00  Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00  Type:   CD-ROM                           ANSI  SCSI revision: 05Host: scsi2 Channel: 00 Id: 00 Lun: 00  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0   Type:   Direct-Access                    ANSI  SCSI revision: 02Host: scsi2 Channel: 00 Id: 01 Lun: 00  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0   Type:   Direct-Access                    ANSI  SCSI revision: 02
看一下添加的SCSI硬盘:
# fdisk -lDisk /dev/sda: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000ef79d   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *           1          64      512000   83  linuxPartition 1 does not end on cylinder boundary./dev/sda2              64        2611    20458496   8e  Linux LVMDisk /dev/mapper/VolGroup-lv_root: 18.8 GB, 18832424960 bytes255 heads, 63 sectors/track, 2289 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/mapper/VolGroup-lv_swap: 2113 MB, 2113929216 bytes255 heads, 63 sectors/track, 257 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/sdb: 10.7 GB, 10737418240 bytes              <---这个就是新添加的硬盘255 heads, 63 sectors/track, 1305 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000
后面就是sdb的分区了。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表