Last Updated: February 25, 2016
·
3.716K
· Chao Yang

Remove a scsi device in linux.

Try:

# echo "scsi remove-single-device 7 0 0 0" > /proc/scsi/scsi

7 - host
0 - channel
0 - id
0 - lun

For example,

# cat /proc/scsi/scsi 
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: WDC WD1600AVJS-6 Rev: 01.0
  Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi7 Channel: 00 Id: 00 Lun: 00
  Vendor: ASUS     Model: DRW-24B1ST       Rev: 1.04
  Type:   CD-ROM                           ANSI  SCSI revision: 05
# echo "scsi remove-single-device 7 0 0 0" > /proc/scsi/scsi
# cat /proc/scsi/scsi 
  Attached devices:
  Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: WDC WD1600AVJS-6 Rev: 01.0
  Type:   Direct-Access                    ANSI  SCSI revision: 05

To call it back:

# echo "scsi add-single-device 7 0 0 0" > /proc/scsi/scsi