Help - "/proc/scsi/scsi" vs. "fdisk -l"

Help - "/proc/scsi/scsi" vs. "fdisk -l"

Post by L » Sat, 16 Oct 2004 03:31:01



Hi,

We found an issue with Linux SCSI sub-system and the low-level SCSI driver
we created.

Most time, everything works okay.  We can use "cat /proc/scsi/scsi" or "cat
/proc/partitions" to see all SCSI devices attached to our low-level driver,
and "fdisk -l" also shows such deveices.  However, after running some tests,
we found that "cat /proc/scsi/scsi" still shows all devices, but "fdisk -l"
only shows the internal disk (/dev/sda).  It doesn't show any SCSI devices
attached to our low-level driver any more.  If using "fdisk /dev/sdb", we
see "Unable to open /dev/sdb" message.

My question is can we say for sure all attached devices are still available
and healthy as long as "cat /proc/scsi/scsi" or "cat /proc/partitions" shows
they are there.  Or maybe the information is just cached information and the
devices are gone if "fdisk -l" can not show them?  How can I make sure this?

Your information would be apreciated.

T.
--

 
 
 

Help - "/proc/scsi/scsi" vs. "fdisk -l"

Post by John-Paul Stewar » Sat, 16 Oct 2004 04:08:52



> My question is can we say for sure all attached devices are still available
> and healthy as long as "cat /proc/scsi/scsi" or "cat /proc/partitions" shows
> they are there.  

No.  Hotswapping (either adding or removing) a drive will not change the
contents of /proc/scsi/scsi.  There's a "rescan-scsi-bus.sh" script
(Google for it) that is a convenient way of updating the kernel's idea
of what is/isn't attached.  The script is just a wrapper around
lower-level methods of updating the info.  But the kernel does *not*
*automatically* update /proc/scsi/scsi.

BTW, this thread was multi-posted to different newsgroups.  If you feel
a thread must appear in more than one group, cross-post it instead.

 
 
 

Help - "/proc/scsi/scsi" vs. "fdisk -l"

Post by John-Paul Stewar » Sat, 16 Oct 2004 06:41:44






>>>My question is can we say for sure all attached devices are still available
>>>and healthy as long as "cat /proc/scsi/scsi" or "cat /proc/partitions" shows
>>>they are there.

>>No.  Hotswapping (either adding or removing) a drive will not change the
>>contents of /proc/scsi/scsi.  There's a "rescan-scsi-bus.sh" script
>>(Google for it) that is a convenient way of updating the kernel's idea
>>of what is/isn't attached.  The script is just a wrapper around
>>lower-level methods of updating the info.  But the kernel does *not*
>>*automatically* update /proc/scsi/scsi.

> This is what I did:

> (1) run rescan-scsi-bus.sh
> (2) run "cat /proc/scsi/scsi", which shows 5 disks are attached to our
> low-level driver on host2
> (3) run "fdisk -l", which only shows the internal disk attached to host0,
> but not the above mentioned 5 disks attached to host2.




> Host adapter 0 (mptscsih) found.
> Host adapter 1 (mptscsih) found.
> ./rescan-scsi-bus.sh: line 46: test: too many arguments
> Host adapter /proc/scsi/NSC (NSC 220i) found.
> Host adapter 220i/* (NSC 220i) found.
> Scanning hosts  0 1 /proc/scsi/NSC 220i/* channels 0 for

OK.  It looks like your scsi host isn't properly identifying itself to
the kernel.  The "too many arguments" line is the first clue that
something is wrong, but the "Host adapter /proc/scsi/NSC (NSC 220i)
found" line should read more like the first two.  It should probably be:

Host adapter 2 (NSC 220i) found.

I.e., your third SCSI channel hasn't been assigned a channel number, but
is instead referred to as "/proc/scsi/NSC" where the channel number
ought to be.  Fix that!  The last line in the above quote should then
read like:

Scanning hosts 0 1 2 channels ...

All bets are off until the low-level driver's behaviour is fixed and it
gets a proper channel number.

[snip]

Quote:>>BTW, this thread was multi-posted to different newsgroups.  If you feel
>>a thread must appear in more than one group, cross-post it instead.

> I used to use cross-post before, but people didn't like it and fired at me

Excessive or unwarranted cross-posting is bad.  Multi-posting is worse.
  This whole thread probably should only have been posted to one group,
but if you feel it must go to more than one, cross-posting is the way to
go.  Please see the "Netiquette Guidelines" (RFC 1855 from the IETF, at
http://www.ietf.org/) for more information.
 
 
 

Help - "/proc/scsi/scsi" vs. "fdisk -l"

Post by L » Thu, 21 Oct 2004 01:52:56


Hi John-Paul,

Thanks so much for your information.  It helps.
Sorry for the late response since I took a few day off.

Please see my comments below:

> > This is what I did:

> > (1) run rescan-scsi-bus.sh
> > (2) run "cat /proc/scsi/scsi", which shows 5 disks are attached to our
> > low-level driver on host2
> > (3) run "fdisk -l", which only shows the internal disk attached to
host0,
> > but not the above mentioned 5 disks attached to host2.




> > Host adapter 0 (mptscsih) found.
> > Host adapter 1 (mptscsih) found.
> > ./rescan-scsi-bus.sh: line 46: test: too many arguments
> > Host adapter /proc/scsi/NSC (NSC 220i) found.
> > Host adapter 220i/* (NSC 220i) found.
> > Scanning hosts  0 1 /proc/scsi/NSC 220i/* channels 0 for

> OK.  It looks like your scsi host isn't properly identifying itself to
> the kernel.  The "too many arguments" line is the first clue that
> something is wrong, but the "Host adapter /proc/scsi/NSC (NSC 220i)
> found" line should read more like the first two.  It should probably be:

> Host adapter 2 (NSC 220i) found.

> I.e., your third SCSI channel hasn't been assigned a channel number, but
> is instead referred to as "/proc/scsi/NSC" where the channel number
> ought to be.  Fix that!  The last line in the above quote should then
> read like:

> Scanning hosts 0 1 2 channels ...

> All bets are off until the low-level driver's behaviour is fixed and it
> gets a proper channel number.

Yes, I agree with your comments.  The problem is probably because
rescan-scsi-bus.sh does not find our driver as a recognized host (number).
I don't know where and how rescan-scsi-bus.sh find the host (number)
information like:

Host adapter 0 (mptscsih) found.
Host adapter 1 (mptscsih) found.
./rescan-scsi-bus.sh: line 46: test: too many arguments
Host adapter /proc/scsi/NSC (NSC 220i) found.

Does any one know where and how rescan-scsi-bus.sh finds host
adapter number: 0, 1...?  It seems it just finds our driver/host info
from directory "/proc/scsi/" (rescan-scsi-bus ignore 220i because
the space in front of it).  I can find both "mptscsih" and "NSC 220i"
under /proc/scsi

In our SCSI low-level driver, we just use function calls
"proc_info" and "info" when register our driver.  I think the Linux
SCSI mid-layer scans host by host and assign the host numbers to
the detected hosts.  Please correct me if I'm wrong.

Thanks,

T.
--

Quote:> [snip]
> >>BTW, this thread was multi-posted to different newsgroups.  If you feel
> >>a thread must appear in more than one group, cross-post it instead.

> > I used to use cross-post before, but people didn't like it and fired at
me

> Excessive or unwarranted cross-posting is bad.  Multi-posting is worse.
>   This whole thread probably should only have been posted to one group,
> but if you feel it must go to more than one, cross-posting is the way to
> go.  Please see the "Netiquette Guidelines" (RFC 1855 from the IETF, at
> http://www.ietf.org/) for more information.

Thanks for the info.  I'll refer to this post if any one fires at me next
time when
I do cross-post  :-)