Linux 掛載iscsi存儲磁盤設備


 

1check網絡

[root@localhost ~]# ping -I eth0 11.110.10.138

PING 11.110.10.138 (11.110.10.138) from 11.110.10.138eth0: 56(84) bytes of data.

64 bytes from 11.110.10.138: icmp_seq=1ttl=64 time=0.023 ms

64 bytes from 11.110.10.138: icmp_seq=2ttl=64 time=0.016 ms

64 bytes from 11.110.10.138: icmp_seq=3ttl=64 time=0.018 ms

^C

--- 11.110.10.138 ping statistics ---

3 packets transmitted, 3 received, 0%packet loss, time 2186ms

rtt min/avg/max/mdev =0.016/0.019/0.023/0.003 ms

[root@localhost ~]#

 

 

 

[root@localhost ~]# ping -I eth0192.168.180.138

PING 192.168.180.138 (192.168.180.138) from11.110.10.138 eth0: 56(84) bytes of data.

From 11.110.10.138 icmp_seq=2 DestinationHost Unreachable

From 11.110.10.138 icmp_seq=3 DestinationHost Unreachable

From 11.110.10.138 icmp_seq=4 DestinationHost Unreachable

^C

--- 192.168.180.138 ping statistics ---

4 packets transmitted, 0 received, +3errors, 100% packet loss, time 3729ms

pipe 3

[root@localhost ~]#

 

 

2,檢測軟件是否已經安裝

[root@localhost ~]# rpm -qa |grep iscsi

iscsi-initiator-utils-6.2.0.873-2.0.2.el6.x86_64

[root@localhost ~]#

 

 <版權全部。文章同意轉載,但必須以鏈接方式注明源地址。否則追究法律責任!> 
原博客地址:  http://blog.csdn.net/mchdba/article/details/46794809
原作者:黃杉 (mchdba)

3,檢查ISCSI服務是否啟動了和當前級別下的執行情況

[root@localhost ~]# service iscsi status

......

 

 

 

 

 

4。要建立2個文件

[root@localhost ~]# iscsiadm -m iface -Iiscsi_eth0 --op=new

New interface iscsi_eth0 added

[root@localhost ~]# iscsiadm -m iface -Iiscsi_eth1 --op=new

New interface iscsi_eth1 added

[root@localhost ~]#

 

 

5.建立iscsi_eth0eht0的映射關系。

同一時候建立iscsi_eth1eth1的映射關系.

也能夠直接編輯iscsi_eth0和iscsi_eth1文件,把里面的iface.net_ifacename=default改成

iface.net_ifacename=eth0和iface.net_ifacename=eth1就可以。

[root@localhost ~]# ls/var/lib/iscsi/ifaces/

iscsi_eth0 iscsi_eth1  iscsi_the0  iscsi_the1

[root@localhost ~]# cd/var/lib/iscsi/ifaces/

[root@localhost ifaces]# ll

總用量 16

-rw------- 1 root root 197 6月  10 16:05 iscsi_eth0

-rw------- 1 root root 197 6月  10 16:06 iscsi_eth1

-rw------- 1 root root 197 4月   3 19:14 iscsi_the0

-rw------- 1 root root 197 4月   3 19:14 iscsi_the1

[root@localhost ifaces]# cat iscsi_eth0

# BEGIN RECORD 6.2.0-873.2.el6

iface.iscsi_ifacename = iscsi_eth0

iface.transport_name = tcp

iface.vlan_id = 0

iface.vlan_priority = 0

iface.iface_num = 0

iface.mtu = 0

iface.port = 0

# END RECORD

[root@localhost ifaces]#

[root@localhost ifaces]# iscsiadm -m iface-I iscsi_eth0 --op=update -n iface.net_ifacename -v eth0

iscsi_eth0 updated.

[root@localhost ifaces]# iscsiadm -m iface-I iscsi_eth0 --op=update -n iface.net_ifacename -v eth0

iscsi_eth0 updated.

[root@localhost ifaces]#

 

 

 

6,重新啟動iscsi服務

[root@localhost ifaces]# service iscsi restart

停止 iscsi:                                              [確定]

正在啟動 iscsi:                                           [確定]

[root@localhost ifaces]#

 

Equallogic配置部分

 

7.配置Equallogic,映射一個Lun名字為redhat,大小3G的空間

在存儲訪問站點上,去分配新的磁盤塊,這個比較簡單。就不截圖了,存儲設備都會自帶一個網址讓我們訪問的。

 

 

Redhat配置部分

8.discover。能夠發現已經看到了redhatlun。由於有兩條路徑。全部顯示了兩行。

 

[root@localhost ifaces]# iscsiadm -mdiscovery -t sendtargets -p 11.110.10.138:3260

iscsiadm: cannot make connection to 11.110.10.138:Connection refused

 

iscsiadm: cannot make connection to 11.110.10.138:Connection refused

iscsiadm: cannot make connection to 11.110.10.138:Connection refused

iscsiadm: cannot make connection to 11.110.10.138:Connection refused

^Ciscsiadm: caught SIGINT, exiting...

[root@localhost ifaces]#

 

ip地址是存儲的ip地址

[root@localhost ifaces]# iscsiadm -mdiscovery -t sendtargets -p 11.110.10.22 :3260

iscsiadm: This command will remove therecord [iface: default, target:iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata, portal: 11.110.10.22,3260],but a session is using it. Logout session then rerun command to remove record.

iscsiadm: This command will remove therecord [iface: default, target:iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2, portal:11.110.10.22,3260], but a session is using it. Logout session then reruncommand to remove record.

11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata

11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2

11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3

11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata

11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2

11.110.10.22:3260,1 iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3

11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata

11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2

11.110.10.22:3260,1 iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3

11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata

11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2

11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3

[root@localhost ifaces]#

 

 

9.Log on全部的iscsi session,能夠看到最后兩個successfulredhat lun,已經log on成功了。

[root@localhost ifaces]# iscsiadm -m node-l

Logging in to [iface: iscsi_eth1, target:iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata, portal: 11.110.10.22,3260](multiple)

Logging in to [iface: iscsi_eth0, target:iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata, portal: 11.110.10.22,3260](multiple)

Logging in to [iface: iscsi_the1, target:iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata, portal: 11.110.10.22,3260](multiple)

Logging in to [iface: iscsi_the0, target:iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata, portal: 11.110.10.22,3260](multiple)

Logging in to [iface: iscsi_eth1, target:iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2, portal:11.110.10.22,3260] (multiple)

Logging in to [iface: iscsi_eth0, target:iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2, portal:11.110.10.22,3260] (multiple)

Logging in to [iface: iscsi_the1, target:iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2, portal:11.110.10.22,3260] (multiple)

Logging in to [iface: iscsi_the0, target:iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2, portal:11.110.10.22,3260] (multiple)

Logging in to [iface: iscsi_eth1, target:iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3, portal:11.110.10.22,3260] (multiple)

Logging in to [iface: iscsi_eth0, target:iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3, portal:11.110.10.22,3260] (multiple)

Logging in to [iface: iscsi_the1, target:iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3, portal:11.110.10.22,3260] (multiple)

Logging in to [iface: iscsi_the0, target:iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3, portal:11.110.10.22,3260] (multiple)

Login to [iface: iscsi_eth1, target:iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata, portal: 11.110.10.22,3260]successful.

Login to [iface: iscsi_eth0, target:iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata, portal: 11.110.10.22,3260]successful.

Login to [iface: iscsi_the1, target:iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata, portal: 11.110.10.22,3260]successful.

Login to [iface: iscsi_the0, target:iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata, portal: 11.110.10.22,3260]successful.

Login to [iface: iscsi_eth1, target:iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2, portal:11.110.10.22,3260] successful.

Login to [iface: iscsi_eth0, target:iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2, portal:11.110.10.22,3260] successful.

Login to [iface: iscsi_the1, target:iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2, portal:11.110.10.22,3260] successful.

Login to [iface: iscsi_the0, target:iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2, portal:11.110.10.22,3260] successful.

Login to [iface: iscsi_eth1, target:iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3, portal:11.110.10.22,3260] successful.

Login to [iface: iscsi_eth0, target:iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3, portal:11.110.10.22,3260] successful.

Login to [iface: iscsi_the1, target:iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3, portal:11.110.10.22,3260] successful.

Login to [iface: iscsi_the0, target:iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3, portal:11.110.10.22,3260] successful.

[root@localhost ifaces]#

 

 

 

10:輸入iscsiadm -m session能夠看到當前正在連接的session.

[root@localhost ifaces]# iscsiadm -msession

tcp: [10] 11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2

tcp: [11] 11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2

tcp: [12] 11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2

tcp: [13] 11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3

tcp: [14] 11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3

tcp: [15] 11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3

tcp: [16] 11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6591f7f09-cf5248cfafa5577e-pddata3

tcp: [3] 11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata

tcp: [4] 11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-4061f7f09-29d248cfaed54b9d-pddata2

tcp: [5] 11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata

tcp: [6] 11.110.10.22:3260,1iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata

tcp: [7] 11.110.10.22:3260,1 iqn.2001-05.com.equallogic:0-8a0906-6dac38009-c1b1cac2d434efec-pddata

tcp: [8] 11.110.10.22:3260,1iqn.2001-0


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM