I have some iSCSI targets mounted on a linux host as /dev/sd*. How can I query the iSCSI ID from the device node?

This is on CentOS 5, using the iscsi-initiator-utils package.

link|improve this question

52% accept rate
feedback

4 Answers

up vote 1 down vote accepted

If you look into

 /dev/disk/by-path/

you should see links to your devices

link|improve this answer
Fabulous, thank you. – kdt Mar 14 '11 at 15:41
Thanks Daniel! I didn't know that. – sciurus Mar 16 '11 at 2:08
feedback
iscsiadm --mode session -P 3

That will produce lots of extraneous output. You care about the Target line that comes before the Attached scsi disk line for the device in question.

link|improve this answer
Yep, that works. – kdt Mar 15 '11 at 12:19
feedback

I'm pretty sure you can get the ID by issuing iscsiadm -m discovery -t st -p <target-ip>.

link|improve this answer
Unfortunately that command only lists all IDs for a server, it doesn't let me match them up with local device nodes. – kdt Mar 14 '11 at 15:13
feedback

Does lsscsi --verbose give you this information (haven't played with iSCSI much)?

link|improve this answer
Doesn't seem to. There's also a --long option, but no joy there either. It prints handy paths into /sys for the device, but I can't see any iSCSI IDs in there either. – kdt Mar 14 '11 at 15:34
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.