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
661 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
  • 8
10 Comments
 
LVL 36

Accepted Solution

by:
ArneLovius earned 250 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 250 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
 

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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
apply ddos protection on all network interface 2 51
Issue to mail 11 39
M2 drive not showing up 16 60
Adding JBOD to a VMware host 2 35
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now