Chinaunix

标题: linux 下scsi磁盘热插拔 [打印本页]

作者: ljh1405    时间: 2007-08-28 15:44
标题: linux 下scsi磁盘热插拔

First thing you have to do is make sure nothing is using the device. Check if you have software raid that it's been faild. Hopefully you didn't have a directory hard mounted on the system.
then you must find some information on the drive that was pulled....
cat /proc/scsi/scsi
Get the HOST CHAN ID and LUN #'s for the device. Then...
echo "scsi-remove-single-device HOST CHAN DEV LUN' > /proc/scsi/scsi
That removes the device from the system.
Hot Add the drive
echo "scsi-add-single-device HOST CHAN DEV LUN' > /proc/scsi/scsi
Adds it back in and spins it up.
-Nate
EXAMPLE: ASSUME IT WAS SDC REMOVEDB:
# cat /proc/scsi/scsi
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: IBM      Model: DMVS09M          Rev: 0220
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: SEAGATE  Model: ST318406LC       Rev: 8A03
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 02 Lun: 00
  Vendor: IBM      Model: DDYS-T09170M     Rev: S93E
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 03 Lun: 00
  Vendor: IBM      Model: DDYS-T09170M     Rev: S93E
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 06 Lun: 00
  Vendor: DELL     Model: 1x4 U2W SCSI BP  Rev: 1.16
  Type:   Processor                        ANSI SCSI revision: 02
So that would be
host 0 Channel 0 id 3 lun 0
echo 'scsi-remove-single-device 0 0 2 0' > /proc/scsi/scsi
cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: IBM      Model: DMVS09M          Rev: 0220
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: SEAGATE  Model: ST318406LC       Rev: 8A03
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 03 Lun: 00
  Vendor: IBM      Model: DDYS-T09170M     Rev: S93E
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 06 Lun: 00
  Vendor: DELL     Model: 1x4 U2W SCSI BP  Rev: 1.16
  Type:   Processor                        ANSI SCSI revision: 02
Device is now gone
echo 'scsi-add-single-device 0 0 3 0' > /proc/scsi/scsi
And the device is back.
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: IBM      Model: DMVS09M          Rev: 0220
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: SEAGATE  Model: ST318406LC       Rev: 8A03
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 02 Lun: 00
  Vendor: IBM      Model: DDYS-T09170M     Rev: S93E
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 03 Lun: 00
  Vendor: IBM      Model: DDYS-T09170M     Rev: S93E
  Type:   Direct-Access                    ANSI SCSI revision: 03
Host: scsi0 Channel: 00 Id: 06 Lun: 00
  Vendor: DELL     Model: 1x4 U2W SCSI BP  Rev: 1.16
  Type:   Processor                        ANSI SCSI revision: 02


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/47198/showart_369709.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2