Can I tell if my iSCSI is already mounted somewhere else?

354 views
Skip to first unread message

guymatz

unread,
Feb 24, 2010, 12:14:37 PM2/24/10
to open-iscsi
Hello,
I would really love to be able to tell if (and ideally where!) an
iSCSI LUN (right word here?) is mounted. I don't want to mount it
twice . . ! Any way to do this? Is there an ideal way to do iSCSI
accounting?

Thanks a lot,
Guy

Boaz Harrosh

unread,
Feb 24, 2010, 2:00:56 PM2/24/10
to open-...@googlegroups.com, guymatz

once you mount your LUN identify it in /dev/disk/by-id/*
from then on it will stay the same no matter whet /dev/sd* it
is. You can specify /dev/disk/by-id/ everywhere, like in fstab
and not care about what letter it has.

If your lun is not mounted you will not find it in /dev/disk/by-id/

(If the LUN has a filesystem on it it will also be in /dev/disk/by-uuid/* )

Good luck
Boaz

guymatz

unread,
Feb 24, 2010, 2:28:30 PM2/24/10
to open-iscsi
Thanks. What I'm really looking to do is have a way to check from
*another* whether the LUN is already in use . . .

Thanks again,
Guy

Mike Christie

unread,
Feb 24, 2010, 2:44:35 PM2/24/10
to open-...@googlegroups.com, guymatz

You could run iscsiadm -m session -P 3 to see the iscsi luns (you would
see /dev/sdX) then run df or mount to see if /dev/sdX is listed as mounted.


Have you seen a way to do this with fibre channel or scsi or sata disks?

guymatz

unread,
Feb 24, 2010, 3:31:30 PM2/24/10
to open-iscsi
Yeah, again, thanks, but that doesn't help me check to see if the LUN
is already mounted on another server, and which one.

thanks again,
Guy

Pasi Kärkkäinen

unread,
Feb 24, 2010, 3:54:57 PM2/24/10
to open-...@googlegroups.com
On Wed, Feb 24, 2010 at 12:31:30PM -0800, guymatz wrote:
> Yeah, again, thanks, but that doesn't help me check to see if the LUN
> is already mounted on another server, and which one.
>

You can only see that from the iSCSI target.

Of if your application or filesystem writes some data about itself (including the node name)
to the LUN, you could read and check that.

-- Pasi

Ulrich Windl

unread,
Feb 25, 2010, 2:51:43 AM2/25/10
to open-...@googlegroups.com

I can think of a two-way process:

1) get the device names for the LUN with "lssci --transport" (SLES10)

2) grep the mounts for those device names (assuming you are not using
multipath)

When using multipath, you should get additional device names with
"multipath -l" before step 2)

Regards,
Ulrich

Ulrich Windl

unread,
Feb 25, 2010, 2:54:36 AM2/25/10
to open-...@googlegroups.com
On 24 Feb 2010 at 11:28, guymatz wrote:

> Thanks. What I'm really looking to do is have a way to check from
> *another* whether the LUN is already in use . . .

Oh, that's simple: It's called "documentation" ;-)

Regards,
Ulrich

Pasi Kärkkäinen

unread,
Feb 25, 2010, 5:27:20 AM2/25/10
to open-...@googlegroups.com

Or you could configure your iSCSI target to only allow one initiator
to attach to the LUN at a time..

-- Pasi

Jörg Delker

unread,
Feb 25, 2010, 9:26:57 AM2/25/10
to open-...@googlegroups.com
Hi Pasi,

could you please explain or give a hint on how to do that - limiting the
target to a single initiator?

My impression was, that this isn't possible with open-iscsi !?

-- Jörg

Am 25.02.10 11:27 schrieb "Pasi Kärkkäinen" unter <pa...@iki.fi>:

Pasi Kärkkäinen

unread,
Feb 25, 2010, 3:53:03 PM2/25/10
to open-...@googlegroups.com
On Thu, Feb 25, 2010 at 03:26:57PM +0100, J�rg Delker wrote:
> Hi Pasi,
>
> could you please explain or give a hint on how to do that - limiting the
> target to a single initiator?
>
> My impression was, that this isn't possible with open-iscsi !?
>

You can't do that with open-iscsi. open-iscsi is an iSCSI initiator (client),
not iSCSI target (server).

You need to configure that in your iSCSI target (=storage server).

-- Pasi

>
> Am 25.02.10 11:27 schrieb "Pasi K�rkk�inen" unter <pa...@iki.fi>:

Jörg Delker

unread,
Feb 26, 2010, 2:09:42 PM2/26/10
to open-...@googlegroups.com
Never mind,
I was under the assumption you were referring to the iscsi-target project
for Linux (http://iscsitarget.sourceforge.net/) when saying:

>>> Or you could configure your iSCSI target to only allow one initiator
>>> to attach to the LUN at a time..

As this seems not the case, please ignore my request.

Cheers,
Jörg


Am 25.02.10 21:53 schrieb "Pasi Kärkkäinen" unter <pa...@iki.fi>:

> On Thu, Feb 25, 2010 at 03:26:57PM +0100, Jörg Delker wrote:
>> Hi Pasi,
>>
>> could you please explain or give a hint on how to do that - limiting the
>> target to a single initiator?
>>
>> My impression was, that this isn't possible with open-iscsi !?
>>
>
> You can't do that with open-iscsi. open-iscsi is an iSCSI initiator (client),
> not iSCSI target (server).
>
> You need to configure that in your iSCSI target (=storage server).
>
> -- Pasi
>
>>

>> Am 25.02.10 11:27 schrieb "Pasi Kärkkäinen" unter <pa...@iki.fi>:

Reply all
Reply to author
Forward
0 new messages