?
Solved

can't see iscsi disk from the SAN even after i created the rule file on CentOS server

Posted on 2013-11-07
10
Medium Priority
?
699 Views
Last Modified: 2013-11-12
I want to slice some storage from SAN device to my file server, it's a CentOS machine.

I modified the /etc/iscsi/initiatorname.iscsi and give the server a new target name.

I updated /etc/iscsi/iscsid.conf and change/uncomment the following under the CHAP Settings.

I can login and log out from the SAN,  even discover the lun on the SAN. but when I tried to access the device from /dev/iscsi, it didn't have one there.

The rule I created is

"This is done through the udev device. You will need to create a device called 55-openiscsi.rules in /etc/udev/rules.d. Create the file and add the below.
      KERNEL=="sd*", BUS=="scsi", PROGRAM="/etc/udev/scripts/iscsidev.sh %b",SYMLINK+="iscsi/%c/part%n"
Then add the following script to /etc/udev/scripts/iscsidev.sh
      #!/bin/sh

      # FILE: /etc/udev/scripts/iscsidev.sh
     
      BUS=${1}
      HOST=${BUS%%:*}
     
      [ -e /sys/class/iscsi_host ] || exit 1
     
      file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/targetname"
     
      target_name=$(cat ${file})
     
      # This is not an open-scsi drive
      if [ -z "${target_name}" ]; then
         exit 1
      fi
     
      echo "${target_name##*:*:}"

This will add a /dev/iscsi path and when a iscsi device is logged into and will create a /dev/iscsi/iscsi-name/part link which links to the actual device. So when the device is mounted you have a persistent drive mapping.
"
0
Comment
Question by:Jason Yu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
10 Comments
 
LVL 37

Accepted Solution

by:
ArneLovius earned 500 total points
ID: 39634310
At a guess, you are trying to follow a guide like this one http://oraclelabs.wordpress.com/virtual-oracle-rac-oracle-enterprise-linux-iscsi-config/

can you confirm that you completed all of the previous steps
0
 
LVL 21

Assisted Solution

by:Mazdajai
Mazdajai earned 500 total points
ID: 39634755
Can you post the output for the following? Have you look into /var/log/messages?

iscsiadm list target

Open in new window

0
 

Author Comment

by:Jason Yu
ID: 39635098
[root@halo ~]# iscsiadm list target
Try `iscsiadm --help' for more information.
[root@halo ~]# /sbin/iscsiadm list target
Try `iscsiadm --help' for more information.
[root@halo ~]# /sbin/iscsiadm --help
iscsiadm -m discoverydb [ -hV ] [ -d debug_level ] [-P printlevel] [ -t type -p ip:port -I ifaceN ... [ -Dl ] ] | [ [ -p ip:port -t type] [ -o operation ] [ -n name ] [ -v value ] [ -lD ] ]
iscsiadm -m discovery [ -hV ] [ -d debug_level ] [-P printlevel] [ -t type -p ip:port -I ifaceN ... [ -l ] ] | [ [ -p ip:port ] [ -l | -D ] ]
iiscsiadm -m node [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -L all,manual,automatic ] [ -U all,manual,automatic ] [ -S ] [ [ -T targetname -p ip:port -I ifaceN ] [ -l | -u | -R | -s] ] [ [ -o  operation  ] [ -n name ] [ -v value ] ]
iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P  printlevel] [ -r sessionid | sysfsdir [ -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ]
iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename | -H hostno|MAC ] [ [ -o  operation  ] [ -n name ] [ -v value ] ]
iscsiadm -m fw [ -l ]
iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ]
iscsiadm -k priority
[root@halo ~]#
0
Stack Overflow Podcast - Developer Story

Welcome to the Stack Overflow podcast recorded Thursday July 20 at Stack Overflow Headquearters in NYC. Your hosts today are podcast regulars Jay Hanlon, David Fullerton, and Ilana Yitzhaki, plus the quite irregular Matt Sherman (Stack Overflow Engineering Manager extraordinaire)

 

Author Comment

by:Jason Yu
ID: 39635099
[root@halo ~]# uname -rn
halo.minkagroup.net 2.6.32-220.4.1.el6.x86_64
[root@halo ~]# cat /etc/*-release
CentOS release 6.2 (Final)
CentOS release 6.2 (Final)
CentOS release 6.2 (Final)
[root@halo ~]#
0
 

Author Comment

by:Jason Yu
ID: 39635100
[root@halo ~]# iscsiadm -m discovery -t st -p 10.0.5.4 -I eth1
10.0.5.4:3260,1 iqn.2003-10.com.lefthandnetworks:bradford:27676:halo-san
[root@halo ~]#
0
 

Author Comment

by:Jason Yu
ID: 39635109
I am almost there except the last step by following the article above.


[root@halo ~]# cd /dev/disk
[root@halo disk]# ls
by-id  by-label  by-path  by-uuid
[root@halo disk]# cd by-path
[root@halo by-path]# ls
ip-10.0.5.4:3260-iscsi-iqn.2003-10.com.lefthandnetworks:bradford:27676:halo-san-lun-0  pci-0000:07:00.0-scsi-0:2:0:0-part2  pci-0000:07:00.0-scsi-0:2:0:0-part5
pci-0000:07:00.0-scsi-0:2:0:0                                                          pci-0000:07:00.0-scsi-0:2:0:0-part3  pci-0000:08:0e.0-scsi-1:0:0:0
pci-0000:07:00.0-scsi-0:2:0:0-part1                                                    pci-0000:07:00.0-scsi-0:2:0:0-part4
[root@halo by-path]# ls -alt
total 0
drwxr-xr-x. 2 root root 200 Nov  8 17:51 .
lrwxrwxrwx. 1 root root   9 Nov  8 17:51 ip-10.0.5.4:3260-iscsi-iqn.2003-10.com.lefthandnetworks:bradford:27676:halo-san-lun-0 -> ../../sdb
drwxr-xr-x. 6 root root 120 Dec 20  2012 ..
lrwxrwxrwx. 1 root root   9 Dec 20  2012 pci-0000:08:0e.0-scsi-1:0:0:0 -> ../../sr0
lrwxrwxrwx. 1 root root   9 Aug 14  2012 pci-0000:07:00.0-scsi-0:2:0:0 -> ../../sda
lrwxrwxrwx. 1 root root  10 Feb 12  2012 pci-0000:07:00.0-scsi-0:2:0:0-part1 -> ../../sda1
lrwxrwxrwx. 1 root root  10 Feb 12  2012 pci-0000:07:00.0-scsi-0:2:0:0-part2 -> ../../sda2
lrwxrwxrwx. 1 root root  10 Feb 12  2012 pci-0000:07:00.0-scsi-0:2:0:0-part5 -> ../../sda5
lrwxrwxrwx. 1 root root  10 Feb 12  2012 pci-0000:07:00.0-scsi-0:2:0:0-part3 -> ../../sda3
lrwxrwxrwx. 1 root root  10 Feb 12  2012 pci-0000:07:00.0-scsi-0:2:0:0-part4 -> ../../sda4
[root@halo by-path]# vi  /etc/udev/rules.d/55-openiscsi.rules
[root@halo by-path]# cd /etc/udev/scripts/
[root@halo scripts]# ls -alt
total 12
drwxr-xr-x. 2 root root 4096 Nov  7 17:43 .
-rwxr-xr-x. 1 root root  337 Nov  7 17:39 iscsidev.sh
drwxr-xr-x. 5 root root 4096 Nov  7 17:38 ..
[root@halo scripts]# vi iscsidev.sh
[root@halo scripts]# chmod 755 iscsidev.sh
[root@halo scripts]# service iscsi stop
Stopping iscsi:                                            [  OK  ]
[root@halo scripts]# service iscsi start
Starting iscsi:                                            [  OK  ]
[root@halo scripts]#
0
 

Author Comment

by:Jason Yu
ID: 39635110
it doesn't create anything under the directory:


[root@halo scripts]# ls -l /dev/iscsi
total 0
[root@halo scripts]#
0
 

Author Comment

by:Jason Yu
ID: 39635112
got the following error in the system log file:


Nov  8 17:50:56 halo kernel: connection8:0: detected conn error (1020)
Nov  8 17:50:57 halo iscsid: Connection8:0 to [target: iqn.2003-10.com.lefthandnetworks:bradford:27676:halo-san, portal: 10.0.5.4,3260] through [iface: eth1] is shutdown.
Nov  8 17:51:02 halo kernel: scsi14 : iSCSI Initiator over TCP/IP
Nov  8 17:51:03 halo kernel: connection9:0: detected conn error (1020)
Nov  8 17:51:05 halo kernel: scsi 14:0:0:0: Direct-Access     LEFTHAND iSCSIDisk        9500 PQ: 0 ANSI: 5
Nov  8 17:51:05 halo kernel: sd 14:0:0:0: [sdb] 1048576000 512-byte logical blocks: (536 GB/500 GiB)
Nov  8 17:51:05 halo kernel: sd 14:0:0:0: [sdb] Write Protect is off
Nov  8 17:51:05 halo kernel: sd 14:0:0:0: [sdb] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
Nov  8 17:51:05 halo kernel: sd 14:0:0:0: Attached scsi generic sg3 type 0
Nov  8 17:51:05 halo kernel: sdb: unknown partition table
Nov  8 17:51:05 halo kernel: sd 14:0:0:0: [sdb] Attached SCSI disk
Nov  8 17:51:06 halo iscsid: Connection9:0 to [target: iqn.2003-10.com.lefthandnetworks:bradford:27676:halo-san, portal: 10.0.5.4,3260] through [iface: eth1] is operational now
Nov  8 17:55:55 halo kernel: connection9:0: detected conn error (1020)
Nov  8 17:55:56 halo iscsid: Connection9:0 to [target: iqn.2003-10.com.lefthandnetworks:bradford:27676:halo-san, portal: 10.0.5.4,3260] through [iface: eth1] is shutdown.
Nov  8 17:56:02 halo kernel: scsi15 : iSCSI Initiator over TCP/IP
Nov  8 17:56:02 halo kernel: connection10:0: detected conn error (1020)
Nov  8 17:56:04 halo kernel: scsi 15:0:0:0: Direct-Access     LEFTHAND iSCSIDisk        9500 PQ: 0 ANSI: 5
Nov  8 17:56:04 halo kernel: sd 15:0:0:0: [sdb] 1048576000 512-byte logical blocks: (536 GB/500 GiB)
Nov  8 17:56:04 halo kernel: sd 15:0:0:0: [sdb] Write Protect is off
Nov  8 17:56:04 halo kernel: sd 15:0:0:0: [sdb] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
Nov  8 17:56:04 halo kernel: sd 15:0:0:0: Attached scsi generic sg3 type 0
Nov  8 17:56:04 halo kernel: sdb: unknown partition table
Nov  8 17:56:04 halo kernel: sd 15:0:0:0: [sdb] Attached SCSI disk
Nov  8 17:56:05 halo iscsid: Connection10:0 to [target: iqn.2003-10.com.lefthandnetworks:bradford:27676:halo-san, portal: 10.0.5.4,3260] through [iface: eth1] is operational now
0
 

Author Comment

by:Jason Yu
ID: 39639313
Any more help. I can see the lun from this command:

[root@halo by-path]# ls -l /dev/disk/by-path/
total 0
lrwxrwxrwx. 1 root root  9 Nov 11 09:32 ip-10.0.5.4:3260-iscsi-iqn.2003-10.com.lefthandnetworks:bradford:27676:halo-san-lun-0 -> ../../sdb
lrwxrwxrwx. 1 root root  9 Aug 14  2012 pci-0000:07:00.0-scsi-0:2:0:0 -> ../../sda
lrwxrwxrwx. 1 root root 10 Feb 12  2012 pci-0000:07:00.0-scsi-0:2:0:0-part1 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Feb 12  2012 pci-0000:07:00.0-scsi-0:2:0:0-part2 -> ../../sda2
lrwxrwxrwx. 1 root root 10 Feb 12  2012 pci-0000:07:00.0-scsi-0:2:0:0-part3 -> ../../sda3
lrwxrwxrwx. 1 root root 10 Feb 12  2012 pci-0000:07:00.0-scsi-0:2:0:0-part4 -> ../../sda4
lrwxrwxrwx. 1 root root 10 Feb 12  2012 pci-0000:07:00.0-scsi-0:2:0:0-part5 -> ../../sda5
lrwxrwxrwx. 1 root root  9 Dec 20  2012 pci-0000:08:0e.0-scsi-1:0:0:0 -> ../../sr0


but I can't see anything under /dev/iscsi folder. I manually created this folder since the script doesnt' create it automaticlly.
0
 

Author Comment

by:Jason Yu
ID: 39640764
got it solved, it the problem of "/sbin/iscsiadm -m iface -I eth1 --op=new" I use a differnet network card name than "etho1".
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video teaches viewers how to encrypt an external drive that requires a password to read and edit the drive. All tasks are done in Disk Utility. Plug in the external drive you wish to encrypt: Make sure all previous data on the drive has been …
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question