Here's what I did.
I used the following line to do a scsi rescan:
for i in /sys/class/scsi_host/host* ; do echo "- - -" > $i/scan ;
sleep 1 ; done
The internal sata disk was nicely rescanned (/dev/sda), the iscsi
disks were not. I tried using /sys/class/iscsi_host/host*/scan to
write "- - -" to but those were readonly.
So, what am I doing wrong here?
Thanks,
Albert
This scan attr is actually a the /sys/class/scsi_host_host one. The host
should be a symlink. Are you sure it is read only and the other one you
referenced is rw?
But what do you mean by the sata disk is scanned but the iscsi one is
not? Do you just mean the disks open-iscsi is showing in /sys/block or
/sys/class/scsi_host/host ..../some/luns or /dev/sdX is not getting
updated? If so, the scsi rescan code only adds devices. If you removed a
device on the target the scsi rescan will not remove it for you. If new
devices are not getting added, then you should send some scsi logging
output?
Oh yeah, you can also run:
iscsiadm -m session -r $sid --rescan
To rescan the session.
> This scan attr is actually a the /sys/class/scsi_host_host one. The host
> should be a symlink. Are you sure it is read only and the other one you
> referenced is rw?
Well, I couldn't write the "- - -" in it, so that looks very readonly.
> But what do you mean by the sata disk is scanned but the iscsi one is
> not? Do you just mean the disks open-iscsi is showing in /sys/block or
> /sys/class/scsi_host/host ..../some/luns or /dev/sdX is not getting
> updated? If so, the scsi rescan code only adds devices. If you removed a
The sata disk, being shown as a scsi device, has an entry in /sys/
class/scsi_host as a scsi_host as well, /sys/class/scsi_host/host0.
When I probe /sys/class/scsi_host/host0/scan (with "- - -") it does a
rescan and shows in /var/log/messages again the disk with the
partitions on it, just like you get when you
log into an iscsi target.
So I tried to probe the iscsi disk as well to see if this generates
the same response, but it doesn't.
To be honest, not an action that I had some use for, more like
sticking a needle into something and see when it pulls back, but it is
different from the standard scsi disk (or sata disk) response.
I am lost :) There is no /sys/class/iscsi_host/host*/scan, right? There
is a /sys/class/scsi_host/host*/scan. We agree this one is writable, right?
There is nothing under /sys/class/iscsi_host/host*/ really. There is a
device link, which I assume you mean you followed to get to another
symlink, scsi_host:host*), which is a symlink back to
/sys/class/scsi_host/host*.
Or what error do you get when you write to it? Does ls -l should it is
read only? If it is iscsid would never be able to find iscsi disks since
it uses this same attr for the initial scan.
>> But what do you mean by the sata disk is scanned but the iscsi one is
>> not? Do you just mean the disks open-iscsi is showing in /sys/block or
>> /sys/class/scsi_host/host ..../some/luns or /dev/sdX is not getting
>> updated? If so, the scsi rescan code only adds devices. If you removed a
>
> The sata disk, being shown as a scsi device, has an entry in /sys/
> class/scsi_host as a scsi_host as well, /sys/class/scsi_host/host0.
> When I probe /sys/class/scsi_host/host0/scan (with "- - -") it does a
> rescan and shows in /var/log/messages again the disk with the
> partitions on it, just like you get when you
> log into an iscsi target.
Ah, I see. The output and hehavior is driver specific in this case. The
rescan is getting done for iscsi as well as sata. Try removing a iscsi
disk by doing
echo 1 > /sys/block/sdX/device/delete
then rescanning. You will see the device get added back.
I think only sata actually goes over the sd attached code again, so you
see things like:
SCSI device sda: 78125000 512-byte hdwr sectors (40000 MB)
sda: Write Protect is off
SCSI device sda: drive cache: write back
when you rescan. If you rescan a fcp or spi device you will see
something like iscsi, where normally there is no output unless we are
adding a device.
> I am lost :) There is no /sys/class/iscsi_host/host*/scan, right? There
> is a /sys/class/scsi_host/host*/scan. We agree this one is writable, right?
> Ah, I see. The output and hehavior is driver specific in this case. The
> rescan is getting done for iscsi as well as sata. Try removing a iscsi
> disk by doing
>
> echo 1 > /sys/block/sdX/device/delete
>
> then rescanning. You will see the device get added back.
Yes, tried that and again, your were right ;-)
>
> I think only sata actually goes over the sd attached code again, so you
> see things like:
>
> SCSI device sda: 78125000 512-byte hdwr sectors (40000 MB)
> sda: Write Protect is off
> SCSI device sda: drive cache: write back
>
> when you rescan. If you rescan a fcp or spi device you will see
> something like iscsi, where normally there is no output unless we are
> adding a device.
Sorry about getting you confused at some stage, I just like to kick a
scsi disk every now and then, at home and at work :-)
Thanks,
Albert
That is not completely true. I think with some RAID controller drivers
you might see something interesting.
No problem :) I learned something new about sata rescanning today :)