天天看點

linux iscsi iqn号路徑,[轉載]Linux下設定ISCSI 多路徑[轉]

設定網卡MTU值

#vi

/etc/sysconfig/network-scripts/ifcfg-eth1

按照如下方式修改網卡配置檔案

修改MTU值

# Broadcom Corporation NetXtreme II BCM5708S Gigabit Ethernet

DEVICE=eth1

BOOTPROTO=none

HWADDR=00:22:19:C4:1E:5B

ONBOOT=yes

DHCP_HOSTNAME=lk3

TYPE=Ethernet

IPADDR=172.17.0.23

NETMASK=255.255.255.0

USERCTL=no

IPV6INIT=no

PEERDNS=yes

MTU=9000

設定Flowcontrol

# ethtool

-a eth0檢查eth0的flowcontrol狀态

# ethtool –A eth0 autoneg off

# ethtool –A eth0 rx on tx

on設定flowcontrol

# ethtool

-a eth0

編輯/etc/rc.d/rc.local檔案,将上面三條指令添加到檔案中

#service

network restart

配置iscsi及multipathd服務

#cd/mnt/server

#rpm

–ivh iscsi-initiator-utils

6.2.0.868 0.18.el5.x86_64.rpm

# service

iscsi start

# chkconfig

–-list iscsi檢視ISCSI服務開機啟動情況

# chkconfig

–-add iscsi

# chkconfig

iscsi on設定ISCSI開機自啟動

# chkconfig

--list multipathd

# chkconfig

–-add multipathd

# chkconfig

multipathd on設定multipathd服務開機自啟動

#cat

/etc/iscsi/initiatorname.iscsi檢視伺服器ISCSI

iqn name

Configuring

Mulitpath Connections

為MPIO建立接口檔案

#iscsiadm -m

iface -I eth0 -o new

.

.

#iscsiadm –m

iface –I eth4 –o new

更新接口名稱

#iscsiadm

–m iface –I eth0 --op=update –n iface.net_ifacename –v

eth0

.

.

#iscsiadm

–m iface –I eth4 --op=update –n iface.net_ifacename –v

eth4

檢查每個網卡的接口檔案配置

#cat /var/lib/iscsi/ifaces/eth0

Example:

iface.iscsi_ifacename

= eth0

iface.net_ifacename

= eth0

iface.hwaddress

= default

iface.transport_name = tcp

掃描ISCSI Targets

# iscsiadm

-m discovery -t st -p 172.23.10.240:3260

登陸到所有Targets.

#iscsiadm –m

node –l

Log into an

individual target

#iscsiadm –m node –l –T iqn.2001-05.com.equallogic:

83bcb3401-16e0002fd0a46f3d-rhel5-test –p

172.23.10.240:3260

檢查ISCSI

sessions

#iscsiadm -m

session –i

登出ISCSI Targets

#iscsiadm –m

node –u –T

iqn.2001-05.com.equallogic:0-8a0906-83bcb3401-16e0002fd0a46f3d-rhel5-test

–p 172.23.10.240:3260

設定Persistent Device

naming

Multipath.conf檔案如果不存在可以從下面的目錄中copy過來

#cp

/usr/share/doc/device-mapper-multipath-0.4.7/multipath.conf.synthetic

/etc/multipath.conf

#/etc/multipath.conf

注釋掉下面幾行:

#blacklist

{

# devnode

"*"

#}

#service

multipathd restart

#multipath

–v2

#multipath

–ll

mpath0

(36090a01840b3bc833d6fa4d02f00e016)

dm-2 EQLOGIC,100E-00

[size=8.0G][features=0][hhandler=0]

_ round-robin 0

[prio=1][active]

_ 2:0:0:0 sdb

8:16 [active][ready]

上面紅色部分就是volume的UUID,記錄該UUID然後重新編輯/etc/multipath.conf,參考下面方式修改

#multipaths

{

# multipath

{

#wwid

3600508b4000156d700012000000b0000

# alias

yellow

# path_grouping_policy

multibus

# path_checker

readsector0

# path_selector

"round-robin 0"

# failback

immediate

# rr_weight

priorities

# no_path_retry

5

# rr_min_io

100

# }

# multipath

{

# wwid

1DEC_____321816758474

# alias

red

# }

#}

修改後

multipaths

{

multipath

{

wwid36090a02830f251891f74744263735281

aliasrhel5-test

path_grouping_policy

multibus

path_checker

readsector0

path_selector

"round-robin 0"

failback

immediate

rr_weight

priorities

no_path_retry

5

rr_min_io10

}

multipath

{

wwid36090a01840b31c74e173a4873200a02f

aliassvr-vol

}

}

Save the

file, then run:

#multipath –v2

#multipath

–ll

rhel5-test

(36090a02830f251891f74744263735281) dm-1 EQLOGIC,100E-00

[size=100G][features=1

queue_if_no_path][hwhandler=0]

_ round-robin 0

[prio=0][active]

_ 9:0:0:0 sdc

8:48 [active][ready]

svr-vol

(36090a01840b31c74e173a4873200a02f) dm-0 EQLOGIC,100E-00

[size=10G][features=0][hwhandler=0]

_ round-robin 0

[prio=0][enabled]

_ 6:0:0:0 sdb

8:16 [active][ready]

#ls -l

/dev/mapper

total

crw-rw---- 1 root

root 10, 63 2007-11-16 17:15 control

brw-rw---- 1 root

disk 254, 1 2007-11-19 15:59 rhel5-test

brw-rw---- 1 root

disk 254, 0 2007-11-19 15:58 svr-vol

建立分區

#fdisk

/dev/mapper/rhel5-test

建立EXT3檔案系統.

#mkfs.ext3

/dev/mapper/rhel5-test

Mounting iSCSI

Filesystems at Boot

#vi

/etc/fstab

#example

/dev/mapper/rhel5-test

/mnt/rhel5-test ext3 defaults 0 0