Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 719
  • Last Modified:

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

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
Jason Yu
Asked:
Jason Yu
  • 8
2 Solutions
 
ArneLoviusCommented:
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
 
MazdajaiCommented:
Can you post the output for the following? Have you look into /var/log/messages?

iscsiadm list target

Open in new window

0
 
Jason YuAuthor Commented:
[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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Jason YuAuthor Commented:
[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
 
Jason YuAuthor Commented:
[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
 
Jason YuAuthor Commented:
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
 
Jason YuAuthor Commented:
it doesn't create anything under the directory:


[root@halo scripts]# ls -l /dev/iscsi
total 0
[root@halo scripts]#
0
 
Jason YuAuthor Commented:
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
 
Jason YuAuthor Commented:
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
 
Jason YuAuthor Commented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now