挂载iscsi ipsan共享存储及设置multipath多路径
第一次手动挂载iscsi盘:
# iscsiadm -m discovery -t sendtargets -p 10.11.102.1:3260
10.11.102.1:3260,1 iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C0P0
10.11.102.2:3260,9 iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C1P0
10.11.102.3:3260,17 iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C2P0
10.11.102.4:3260,25 iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C3P0
10.11.102.5:3260,3 iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C0P0
10.11.102.6:3260,11 iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C1P0
10.11.102.7:3260,19 iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C2P0
10.11.102.8:3260,27 iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C3P0
# iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C0P0 -p 10.11.102.1:3260 -l
# iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C0P0 -p 10.11.102.1:3260 -R
# iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C0P0 -p 10.11.102.1:3260 -o update -n node.startup -v automatic
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C1P0 -p 10.11.102.2:3260 -l
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C1P0 -p 10.11.102.2:3260 -R
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C1P0 -p 10.11.102.2:3260 -o update -n node.startup -v automatic
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C2P0 -p 10.11.102.3:3260 -l
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C2P0 -p 10.11.102.3:3260 -R
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C2P0 -p 10.11.102.3:3260 -o update -n node.startup -v automatic
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C3P0 -p 10.11.102.4:3260 -l
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C3P0 -p 10.11.102.4:3260 -R
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C0C3P0 -p 10.11.102.4:3260 -o update -n node.startup -v automatic
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C0P0 -p 10.11.102.5:3260 -l
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C0P0 -p 10.11.102.5:3260 -R
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C0P0 -p 10.11.102.5:3260 -o update -n node.startup -v automatic
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C1P0 -p 10.11.102.6:3260 -l
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C1P0 -p 10.11.102.6:3260 -R
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C1P0 -p 10.11.102.6:3260 -o update -n node.startup -v automatic
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C2P0 -p 10.11.102.7:3260 -l
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C2P0 -p 10.11.102.7:3260 -R
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C2P0 -p 10.11.102.7:3260 -o update -n node.startup -v automatic
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C3P0 -p 10.11.102.8:3260 -l
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C3P0 -p 10.11.102.8:3260 -R
iscsiadm -m node -T iqn.2000-09.com.fujitsu:storage-system.eternus-dx400:00C1C3P0 -p 10.11.102.8:3260 -o update -n node.startup -v automatic
配置重启可以自动挂载:
要加入到rc.local里面是因为路由是后加的。
# chkconfig iscsi off
# chkconfig iscsid off
# vi /etc/rc.local
route add -net 10.11.0.0 netmask 255.255.0.0 gw 10.11.202.254
service iscsi restart
service iscsid restart
配置多路径:
# yum install device-mapper-multipath
# cp /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf /etc/
# vi /etc/multipath.conf
defaults {
user_friendly_names yes
}
blacklist {
wwid 26353900f02796769
devnode “^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*”
devnode “^vd[a-z]”
}
multipaths {
multipath {
wwid 3600000e00d1000000010084600080000
alias ipsan
uid 0
gid 0
mode 0600
}
}
# service multipathd start
# multipath -v0
# multipath -ll
mpatha (3600000e00d1000000010084600100000) dm-0 FUJITSU,ETERNUS_DX400
size=411G features=’1 queue_if_no_path’ hwhandler=’0′ wp=rw
|-+- policy=’round-robin 0′ prio=130 status=active
| `- 5:0:0:0 sda 8:0 active ready running
`-+- policy=’round-robin 0′ prio=10 status=enabled
`- 7:0:0:0 sdb 8:16 active ready running
# fdisk -l
Disk /dev/mapper/mpatha: 441.3 GB, 441307889664 bytes
255 heads, 63 sectors/track, 53652 cylinders
分区、格式化,以后就不用再做这个操作:
# fdisk /dev/mapper/mpatha
分成一个区:/dev/mapper/mpathap1
# multipath -F
# multipath -v0
# mkfs.ext4 /dev/mapper/mpathap1
# mkdir /ipsan
# mount -t ext4 /dev/mapper/mpathap1 /ipsan
设置自动启动,要等iscsid起来后才能加入multipath,系统可以登录之后,需要等待一段时间(1min以上)才能看到mount上:
# chkconfig multipathd off
# vi /etc/rc.local
route add -net 10.11.0.0 netmask 255.255.0.0 gw 10.11.202.254
service iscsi restart
service iscsid restart
service multipathd restart
multipath -F
multipath -v0
sleep 1
mount -t ext4 /dev/mapper/mpathap1 /ipsan