[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: reinitialize scsi devices?



On Mon, 24 Jul 2000, Ron Farrer wrote:

> Is there a way to force the kernel to reinitialize the scsi devices
> without rebooting? For some reason 2.2.14 decided to ignore my tape
> drive on the last reboot and it does not see it (it's not in
> proc/scsi/*). I was curious if there is a way to get the kernel to
> see the tape drive without rebooting (such an annoyance! :) 

This is from the SCSI-Programming HOWTO:

Dynamically insert and remove SCSI devices
If a newer kernel and the /proc file system is running, a non-busy device
can be removed and installed 'on the fly'. 

To remove a SCSI device: 

echo "scsi remove-single-device a b c d" > /proc/scsi/scsi

and similar, to add a SCSI device, do 

echo "scsi add-single-device a b c d" > /proc/scsi/scsi

where 

      a == hostadapter id (first one being 0)
      b == SCSI channel on hostadapter (first one being 0)
      c == ID
      d == LUN (first one being 0)

So in order to swap the /dev/sgc and /dev/sgd mappings from the previous
example, we could do 


echo "scsi remove-single-device 0 0 4 0" > /proc/scsi/scsi
echo "scsi remove-single-device 0 0 5 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 5 0" > /proc/scsi/scsi
echo "scsi add-single-device 0 0 4 0" > /proc/scsi/scsi

since generic devices are mapped in the order of their insertion. 

When adding more devices to the scsi bus keep in mind there are limited
spare entries for new devices. The memory has been allocated at boot time
and has room for 2 more devices. 





Reply to: