On Mon, Jun 16, 2008 at 06:03:25PM -0700, Alex M. wrote:
> On Jun 16, 4:29 pm, Mike Christie <[EMAIL PROTECTED]> wrote:
> > Do:
> >
> > iscsiadm -m session -r $SID --rescan
> Doing a rescan doesn't appear to pick up the new size of the devices.
> Having manually resized the filesystem on the target end, I now get
> errors on the initiator since the filesystem extents are outside of
> the apparent device extents.

That is not a iSCSI issue. It is the SCSI subsystem in the kernel. When you
give the rescan command iscsiadm passes in '- - -' to the 
which kicks off a kernel thread that re-scans for the LUNs. The logic in the 
is that if it finds that a Scsi_Host with a LUN exists already it returns that
one and doesn't do a full re-discover on it.

So you have to delete the Scsi_Host from userland and then follow it with a 

But the reason this is done (and that the kernel doesn't do this automaticlly) 
is that this
operation is very dangerous. If you don't unmount any of the filesystems on 
those block 
devices before you delete them, you will incur data corruption.

> > The above commands will rescan existing devices and add new ones. It
> > will not remove old ones.
> As you said, rescans don't pick up deleted LUN's, so my only option
> would be to delete the LUN on the target and then re-create it under a
> _different_ LUN and then do a rescan. This is obviously not an ideal
> solution as it's going to result in a large number of "zombie" LUNs on
> the initiator as time goes on.

You can delete the old block devices that have changed and do a SCSI rescan:

You have to delete the old devices (well, this script deletes _ALL_ so that 
not be that good):

for disk in `find 
/sys/class/iscsi_session/session*/device/target*/*:*:*:*/delete `
 echo 1 > $disk

And then do the rescan:
#iscsiadm -m session --rescan

Unfortunatly this will delete _all_ of your block devices (sdc, sde, sdd, etc) 
were provided. But it will pick up your new one after the rescan. You can 
fiddle with the for loop
above and run 'sg_caps' on the block device, see if it has changed compared to
/sys/block/sdX/device/size and if so delete it:

        scsi_sz=`sg_readcap /dev/sdko | grep address | sed s'/.*blocks=//'`
        kernel_sz=`cat /sys/block/sdko/device/block\:sdko/size`

        if (($scsi_sz==$kernel_sz)); then
                echo "Good."
                echo "Do the deletion of the block device."
                echo 1 > /sys/block/sdko/device/delete

Oh, please be carefull. These scripts will delete your block devices, so if you 
delete your
root one or any other one that is used - you are screwed.  Make sure you first 
any of the filesystems on those block devices and sync it so that there are no
outstanding I/Os.

You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi

Reply via email to