CentOS Study Notes-SCSI device hot swapping, centos-scsi
CentOS Study Notes-SCSI device hot swapping
In the running server, the server may not be allowed to be restarted due to business requirements. How can the newly added SCSI device (mainly hard disk) be hot-swappable?
First, check the device:
#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
You can see two devices: CD-ROM and Direct-Access.
After knowing the SCSI device, you can scan the new device again (in this example, add a SCSI hard disk ):
# Echo "scsi add-single-device 2 0 1 0">/proc/scsi echo "scsi add-single-device a B c d">/proc/scsi/ in scsi, a indicates the SCSI device number, the above Host: number after scsi. The new number is the same type. The scsi hard disk in the VM is Direct-Access B, which indicates the CHANNEL number. The above channels are basically 0 c, which indicates the ID number, newly Added is the above Id value of the same type + 1 d is the LUN number is generally 0
Check it out:
# 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
Let's take a look at the added SCSI hard drive:
# 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 8e Linux LVMDisk/dev/mapper/VolGroup-lv_root: 20458496 GB, 18.8 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: 0x000000000000disk/dev/sdb: 10.7 GB, 10737418240 bytes <--- this is the newly added hard drive 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
The next step is the sdb partition.