Linux挂载ISCSI TARGET磁盘

 1.安装iscsi-initiator-utils包:

[root@rhel2 .vnc]#mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@rhel2 .vnc]# cd /mnt/Server
[root@rhel2 Server]#rpm -ivh iscsi-initiator-utils-6.2.0.871-0.10.el5.i386.rpm
warning: iscsi-initiator-utils-6.2.0.871-0.10.el5.i386.rpm: Header V3 DSA signat                                             
ure: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:iscsi-initiator-utils  ########################################### [100%]
[root@rhel2 Server]# iscsiadm
iscsiadm -m discovery [ -hV ] [ -d debug_level ] [-P printlevel] [ -t type -p ip                                             
:port -I ifaceN ... [ -l ] ] | [ -p ip:port ] [ -o operation ] [ -n name ] [ -v                                              
value ]
iscsiadm -m node [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -L all,manual,au                                             
tomatic ] [ -U all,manual,automatic ] [ -S ] [ [ -T targetname -p ip:port -I ifa                                             
ceN ] [ -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 ]                                              
[ [ -o  operation  ] [ -n name ] [ -v value ] ]
iscsiadm -m fw [ -l ]
iscsiadm -m host [ -P printlevel ] [ -H hostno ]
iscsiadm -k priority
 
2.确保和存储服务器的连通:
[root@rhel2 Server]#ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=7.12 ms
 
--- 1.1.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 7.129/7.129/7.129/0.000 ms
 
3.探测存储设备失败:
[root@rhel2 Server]#iscsiadm -m discovery -t sendtargets -p 1.1.1.1:3260
iscsiadm: can not connect to target="_self">iSCSI daemon (111)!
iscsiadm: can not connect to iSCSI daemon (111)!
iscsiadm: Cannot perform. discovery. Initiatorname required.
iscsiadm: Discovery process to 1.1.1.1:3260 failed to create a discovery session.
 
4.安装kernel相关包:
需要安装iscsi-target,这个可以到sf.net上下载最新的来编译,编译需要内核文件,所以要安装kernel,kernel-devel,kernel-headers3个包。
安装这3个包:
[root@rhel2 Server]# ls kernel*
kernel-2.6.18-164.el5.i686.rpm              kernel-headers-2.6.18-164.el5.i386.rpm
kernel-debug-2.6.18-164.el5.i686.rpm        kernel-PAE-2.6.18-164.el5.i686.rpm
kernel-debug-devel-2.6.18-164.el5.i686.rpm  kernel-PAE-devel-2.6.18-164.el5.i686.rpm
kernel-devel-2.6.18-164.el5.i686.rpm        kernel-xen-2.6.18-164.el5.i686.rpm
kernel-doc-2.6.18-164.el5.noarch.rpm        kernel-xen-devel-2.6.18-164.el5.i686.rpm
[root@rhel2 Server]#rpm -ivh kernel-devel-2.6.18-164.el5.i686.rpm kernel-headers-2.6.18-164.el5.i386.rpm
warning: kernel-devel-2.6.18-164.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:kernel-headers         ########################################### [ 50%]
   2:kernel-devel           ########################################### [100%]
 
5.安装iscsi-target:
[root@rhel2 Server]# cd /opt/soft/
[root@rhel2 soft]# ls
iscsitarget-1.4.20.2.tar.gz
[root@rhel2 soft]# gunzip *.gz
[root@rhel2 soft]# tar xvf *.tar
iscsitarget-1.4.20.2/
iscsitarget-1.4.20.2/README.mcs
iscsitarget-1.4.20.2/ChangeLog
iscsitarget-1.4.20.2/RELEASE_NOTES
iscsitarget-1.4.20.2/COPYING
iscsitarget-1.4.20.2/Makefile
iscsitarget-1.4.20.2/etc/
iscsitarget-1.4.20.2/etc/initd/
iscsitarget-1.4.20.2/etc/initd/initd
iscsitarget-1.4.20.2/etc/initd/initd.debian
iscsitarget-1.4.20.2/etc/initd/initd.redhat
iscsitarget-1.4.20.2/etc/initd/initd.gentoo
iscsitarget-1.4.20.2/etc/ietd.conf
iscsitarget-1.4.20.2/etc/initiators.allow
iscsitarget-1.4.20.2/etc/initiators.deny
iscsitarget-1.4.20.2/etc/targets.allow
iscsitarget-1.4.20.2/kernel/
iscsitarget-1.4.20.2/kernel/file-io.c
iscsitarget-1.4.20.2/kernel/null-io.c
iscsitarget-1.4.20.2/kernel/session.c
iscsitarget-1.4.20.2/kernel/iscsi_hdr.h
iscsitarget-1.4.20.2/kernel/iscsi.h
iscsitarget-1.4.20.2/kernel/conn.c
iscsitarget-1.4.20.2/kernel/block-io.c
iscsitarget-1.4.20.2/kernel/tio.c
iscsitarget-1.4.20.2/kernel/compat.h
iscsitarget-1.4.20.2/kernel/Makefile
iscsitarget-1.4.20.2/kernel/digest.c
iscsitarget-1.4.20.2/kernel/event.c
iscsitarget-1.4.20.2/kernel/iscsi_dbg.h
iscsitarget-1.4.20.2/kernel/digest.h
iscsitarget-1.4.20.2/kernel/config.c
iscsitarget-1.4.20.2/kernel/nthread.c
iscsitarget-1.4.20.2/kernel/ua.c
iscsitarget-1.4.20.2/kernel/target.c
iscsitarget-1.4.20.2/kernel/iotype.c
iscsitarget-1.4.20.2/kernel/iotype.h
iscsitarget-1.4.20.2/kernel/iscsi.c
iscsitarget-1.4.20.2/kernel/wthread.c
iscsitarget-1.4.20.2/kernel/target_disk.c
iscsitarget-1.4.20.2/kernel/volume.c
iscsitarget-1.4.20.2/kernel/param.c
iscsitarget-1.4.20.2/dkms.conf
iscsitarget-1.4.20.2/README.vmware
iscsitarget-1.4.20.2/usr/
iscsitarget-1.4.20.2/usr/ietadm.h
iscsitarget-1.4.20.2/usr/session.c
iscsitarget-1.4.20.2/usr/ietadm.c
iscsitarget-1.4.20.2/usr/chap.c
iscsitarget-1.4.20.2/usr/message.c
iscsitarget-1.4.20.2/usr/iscsi_hdr.h
iscsitarget-1.4.20.2/usr/log.c
iscsitarget-1.4.20.2/usr/plain.c
iscsitarget-1.4.20.2/usr/md5.c
iscsitarget-1.4.20.2/usr/conn.c
iscsitarget-1.4.20.2/usr/iscsid.c
iscsitarget-1.4.20.2/usr/param.h
iscsitarget-1.4.20.2/usr/Makefile
iscsitarget-1.4.20.2/usr/isns_proto.h
iscsitarget-1.4.20.2/usr/md5.h
iscsitarget-1.4.20.2/usr/event.c
iscsitarget-1.4.20.2/usr/ietd.c
iscsitarget-1.4.20.2/usr/sha1.h
iscsitarget-1.4.20.2/usr/target.c
iscsitarget-1.4.20.2/usr/config.h
iscsitarget-1.4.20.2/usr/types.h
iscsitarget-1.4.20.2/usr/isns.c
iscsitarget-1.4.20.2/usr/iscsid.h
iscsitarget-1.4.20.2/usr/sha1.c
iscsitarget-1.4.20.2/usr/ctldev.c
iscsitarget-1.4.20.2/usr/param.c
iscsitarget-1.4.20.2/usr/misc.h
iscsitarget-1.4.20.2/iscsitarget.spec
iscsitarget-1.4.20.2/include/
iscsitarget-1.4.20.2/include/iet_u.h
iscsitarget-1.4.20.2/README.initiators
iscsitarget-1.4.20.2/doc/
iscsitarget-1.4.20.2/doc/manpages/
iscsitarget-1.4.20.2/doc/manpages/ietd.8
iscsitarget-1.4.20.2/doc/manpages/ietd.conf.5
iscsitarget-1.4.20.2/doc/manpages/ietadm.8
iscsitarget-1.4.20.2/patches/
iscsitarget-1.4.20.2/patches/compat-2.6.29.patch
iscsitarget-1.4.20.2/patches/compat-2.6.24.patch
iscsitarget-1.4.20.2/patches/compat-2.6.32.patch
iscsitarget-1.4.20.2/patches/compat-2.6.25-2.6.27.patch
iscsitarget-1.4.20.2/patches/compat-2.6.30.patch
iscsitarget-1.4.20.2/patches/compat-2.6.23.patch
iscsitarget-1.4.20.2/patches/compat-2.6.28.patch
iscsitarget-1.4.20.2/patches/compat-2.6.19-2.6.21.patch
iscsitarget-1.4.20.2/patches/compat-rhel4.patch
iscsitarget-1.4.20.2/patches/compat-2.6.14-2.6.18.patch
iscsitarget-1.4.20.2/patches/compat-sles10sp2.patch
iscsitarget-1.4.20.2/patches/compat-2.6.22.patch
iscsitarget-1.4.20.2/patches/compat-2.6.31.patch
iscsitarget-1.4.20.2/README
[root@rhel2 soft]# ls
iscsitarget-1.4.20.2  iscsitarget-1.4.20.2.tar
[root@rhel2 soft]# cd iscsitarget-1.4.20.2
[root@rhel2 iscsitarget-1.4.20.2]# ls
ChangeLog  dkms.conf  etc      iscsitarget.spec  Makefile  README             README.mcs     RELEASE_NOTES
COPYING    doc        include  kernel            patches   README.initiators  README.vmware  usr
 
开始编译iscsi-target,报错 需要gcc编译器:
[root@rhel2 iscsitarget-1.4.20.2]#make kernel
/bin/sh: cc: command not found
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -lt: unary operator expected
make -C /lib/modules/2.6.18-164.el5/build SUBDIRS=/opt/soft/iscsitarget-1.4.20.2/kernel modules
/usr/src/kernels/2.6.18-164.el5-i686/scripts/gcc-version.sh: line 11: gcc: command not found
/usr/src/kernels/2.6.18-164.el5-i686/scripts/gcc-version.sh: line 12: gcc: command not found
make[1]: gcc: Command not found
make[1]: Entering directory `/usr/src/kernels/2.6.18-164.el5-i686'
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/tio.o
/bin/sh: gcc: command not found
make[2]: *** [/opt/soft/iscsitarget-1.4.20.2/kernel/tio.o] Error 127
make[1]: *** [_module_/opt/soft/iscsitarget-1.4.20.2/kernel] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.18-164.el5-i686'
make: *** [kernel] Error 2
 
6.安装GCC编译器:
[root@rhel2 iscsitarget-1.4.20.2]# cd /mnt/Server
[root@rhel2 Server]# rpm -ivh gcc-4.1.2-46.el5.i386.rpm
warning: gcc-4.1.2-46.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        glibc-devel >= 2.2.90-12 is needed by gcc-4.1.2-46.el5.i386
        libgomp >= 4.1.2-46.el5 is needed by gcc-4.1.2-46.el5.i386
[root@rhel2 Server]# rpm -ivh gcc-4.1.2-46.el5.i386.rpm \
> glibc-devel-2.5-42.i386.rpm libgomp-4.4.0-6.el5.i386.rpm
warning: gcc-4.1.2-46.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        glibc-headers is needed by glibc-devel-2.5-42.i386
        glibc-headers = 2.5-42 is needed by glibc-devel-2.5-42.i386
[root@rhel2 Server]#rpm -ivh gcc-4.1.2-46.el5.i386.rpm glibc-devel-2.5-42.i386.rpm libgomp-4.4.0-6.el5.i386.rpm \
> glibc-headers-2.5-42.i386.rpm
warning: gcc-4.1.2-46.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:libgomp                ########################################### [ 25%]
   2:glibc-headers          ########################################### [ 50%]
   3:glibc-devel            ########################################### [ 75%]
   4:gcc                    ########################################### [100%]
[root@rhel2 Server]# cd /opt/soft/
[root@rhel2 soft]# ls
iscsitarget-1.4.20.2  iscsitarget-1.4.20.2.tar
[root@rhel2 soft]# cd iscsitarget-1.4.20.2
[root@rhel2 iscsitarget-1.4.20.2]# ls
ChangeLog  dkms.conf  etc      iscsitarget.spec  Makefile  README             README.mcs     RELEASE_NOTES
COPYING    doc        include  kernel            patches   README.initiators  README.vmware  usr
 
再次执行make kernel,成功:
[root@rhel2 iscsitarget-1.4.20.2]#make kernel
Applying Patch compat-2.6.32.patch
patching file kernel/conn.c
Applying Patch compat-2.6.31.patch
patching file kernel/file-io.c
Applying Patch compat-2.6.30.patch
patching file kernel/block-io.c
Hunk #1 succeeded at 280 with fuzz 2.
Applying Patch compat-2.6.29.patch
patching file kernel/config.c
Applying Patch compat-2.6.28.patch
patching file kernel/conn.c
Applying Patch compat-2.6.25-2.6.27.patch
patching file kernel/block-io.c
Applying Patch compat-2.6.24.patch
patching file kernel/event.c
Applying Patch compat-2.6.23.patch
patching file kernel/block-io.c
patching file kernel/config.c
patching file kernel/digest.c
patching file kernel/event.c
patching file kernel/volume.c
Hunk #1 succeeded at 91 (offset -1 lines).
Applying Patch compat-2.6.22.patch
patching file kernel/volume.c
Hunk #1 succeeded at 10 (offset -1 lines).
patching file kernel/seq_list.c
patching file kernel/target.c
patching file kernel/seq_list.h
patching file kernel/Makefile
Applying Patch compat-2.6.19-2.6.21.patch
patching file kernel/event.c
patching file kernel/iscsi.c
patching file kernel/tio.c
patching file kernel/ua.c
Applying Patch compat-2.6.14-2.6.18.patch
patching file kernel/iscsi.h
Hunk #1 succeeded at 262 (offset 1 line).
patching file kernel/digest.c
patching file kernel/iscsi.c
patching file kernel/tio.c
patching file kernel/wthread.c
patching file kernel/volume.c
Hunk #1 succeeded at 83 (offset -1 lines).
make -C /lib/modules/2.6.18-164.el5/build SUBDIRS=/opt/soft/iscsitarget-1.4.20.2/kernel modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-164.el5-i686'
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/tio.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/iscsi.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/nthread.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/wthread.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/config.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/digest.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/conn.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/session.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/target.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/volume.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/iotype.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/file-io.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/null-io.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/target_disk.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/event.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/param.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/block-io.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/ua.o
  CC [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/seq_list.o
  LD [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/iscsi_trgt.o
  Building modules, stage 2.
  MODPOST
  CC      /opt/soft/iscsitarget-1.4.20.2/kernel/iscsi_trgt.mod.o
  LD [M]  /opt/soft/iscsitarget-1.4.20.2/kernel/iscsi_trgt.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.18-164.el5-i686'
 
执行make usr,成功:
[root@rhel2 iscsitarget-1.4.20.2]#make usr
make -C usr
make[1]: Entering directory `/opt/soft/iscsitarget-1.4.20.2/usr'
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o ietd.o ietd.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o iscsid.o iscsid.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o conn.o conn.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o session.o session.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o target.o target.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o message.o message.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o ctldev.o ctldev.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o log.o log.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o chap.o chap.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o event.o event.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o param.o param.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o plain.o plain.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o isns.o isns.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o md5.o md5.c
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o sha1.o sha1.c
cc ietd.o iscsid.o conn.o session.o target.o message.o ctldev.o log.o chap.o event.o param.o plain.o isns.o md5.o sha1.o -o ietd
cc -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include -D_GNU_SOURCE    -c -o ietadm.o ietadm.c
cc ietadm.o param.o -o ietadm
make[1]: Leaving directory `/opt/soft/iscsitarget-1.4.20.2/usr'
 
安装iscsi-target:
[root@rhel2 iscsitarget-1.4.20.2]#make install
`usr/ietd' -> `/usr/sbin/ietd'
`usr/ietadm' -> `/usr/sbin/ietadm'
`etc/initd/initd.redhat' -> `/etc/rc.d/init.d/iscsi-target'
install: creating directory `/etc/iet'
`etc/ietd.conf' -> `/etc/iet/ietd.conf'
`etc/initiators.allow' -> `/etc/iet/initiators.allow'
`etc/targets.allow' -> `/etc/iet/targets.allow'
`doc/manpages/ietadm.8' -> `/usr/share/man/man8/ietadm.8'
`doc/manpages/ietd.8' -> `/usr/share/man/man8/ietd.8'
`doc/manpages/ietd.conf.5' -> `/usr/share/man/man5/ietd.conf.5'
install: creating directory `/usr/share/doc/iscsitarget'
`ChangeLog' -> `/usr/share/doc/iscsitarget/ChangeLog'
`COPYING' -> `/usr/share/doc/iscsitarget/COPYING'
`RELEASE_NOTES' -> `/usr/share/doc/iscsitarget/RELEASE_NOTES'
`README' -> `/usr/share/doc/iscsitarget/README'
`README.vmware' -> `/usr/share/doc/iscsitarget/README.vmware'
`README.initiators' -> `/usr/share/doc/iscsitarget/README.initiators'
install: creating directory `/lib/modules/2.6.18-164.el5/extra/iscsi'
`kernel/iscsi_trgt.ko' -> `/lib/modules/2.6.18-164.el5/extra/iscsi/iscsi_trgt.ko'
Running depmod
 
7.iscsi-target存在,安装成功:
[root@rhel2 iscsitarget-1.4.20.2]# cd /etc/init.d/
[root@rhel2 init.d]# ls iscsi*
iscsi  iscsid  iscsi-target
 
8.启动iscsi-target服务:
[root@rhel2 init.d]# ./iscsi-target
Usage: ./iscsi-target {start|stop|restart|condrestart|status}
[root@rhel2 init.d]# ./iscsi-target status
iSCSI Target stopped
[root@rhel2 init.d]#./iscsi-target start
Starting iSCSI Target:                                     [  OK  ]
[root@rhel2 init.d]#
[root@rhel2 init.d]#
 
9.开始探测存储,依然报错:
[root@rhel2 init.d]#iscsiadm -m discovery -t sendtargets -p 1.1.1.1:3260
iscsiadm: can not connect to iSCSI daemon (111)!
iscsiadm: can not connect to iSCSI daemon (111)!
iscsiadm: Cannot perform. discovery. Initiatorname required.
iscsiadm: Discovery process to 1.1.1.1:3260 failed to create a discovery session.
 
10.重启iscsi,iscsid,iscsi-target服务:
[root@rhel2 init.d]# ls iscsi*
iscsi  iscsid  iscsi-target
[root@rhel2 init.d]#./iscsi-target restart
Stopping iSCSI Target:                                     [  OK  ]
Starting iSCSI Target:                                     [  OK  ]
[root@rhel2 init.d]#./iscsid restart
Stopping iSCSI daemon: iscsiadm: can not connect to iSCSI daemon (111)!
iscsiadm: initiator reported error (20 - could not connect to iscsid)
iscsiadm: Could not stop iscsid. Trying sending iscsid SIGTERM or SIGKILL signals manually
 
 
Turning off network shutdown. Starting iSCSI daemon:       [  OK  ]
                                                           [  OK  ]
[root@rhel2 init.d]#./iscsi restart
Stopping iSCSI daemon:
iscsid dead but pid file exists                            [  OK  ]
Turning off network shutdown. Starting iSCSI daemon:       [  OK  ]
                                                           [  OK  ]
Setting up iSCSI targets: iscsiadm: No records found!
                                                           [  OK  ]
[root@rhel2 init.d]#
 
11.再次探测存储,成功:
[root@rhel2 init.d]#iscsiadm -m discovery -t sendtargets -p 1.1.1.1:3260
1.1.1.1:3260,1 iqn.2006-01.com.openfiler:tsn.af7b14fe4761
[root@rhel2 init.d]#
 
12.将探测到的存储挂载到本地:
[root@rhel2 init.d]#iscsiadm -m node -T iqn.2006-01.com.openfiler:tsn.af7b14fe4761 -p 1.1.1.1:3260 -l
Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.af7b14fe4761, portal: 1.1.1.1,3260]
Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.af7b14fe4761, portal: 1.1.1.1,3260]: successful
[root@rhel2 init.d]#
[root@rhel2 init.d]#fdisk -l
 
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        4960    39841168+  83  Linux
/dev/sda2            4961        5221     2096482+  82  Linux swap / Solaris
 
Disk /dev/sdb: 21.4 GB, 21441282048 bytes
64 heads, 32 sectors/track, 20448 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
 
Disk /dev/sdb doesn't contain a valid partition table
 
/dev/sdb即为挂载的探测到的存储设备。

你可能感兴趣的:(linux,职场,target,iSCSI,休闲)