Friday, January 7, 2011
NetApp Fas2020 在REHL 5.4 x86-64 上設定 Multipath I/O [MPIO]
1 . 查看光纖卡是否可以抓到
[root@localhost u1]# dmesg | grep HBA
QLogic Fibre Channel HBA Driver
QLogic Fibre Channel HBA Driver: 8.03.01.04.05.05-k
QLogic Fibre Channel HBA Driver: 8.03.01.04.05.05-k
2 . 查看光纖卡WWPN
[root@localhost mapper]# cat /sys/class/scsi_host/host1/device/fc_host\:host1/port_name
0x210ASDF24fASDFafa
[root@localhost mapper]# cat /sys/class/scsi_host/host2/device/fc_host\:host2/port_name
0x210ASDF24ASDF6afb
find / -name fc_host
3 . 利用 fdisk -l 查看磁碟。
原只有本機硬碟設備 /dev/sda ,當主機兩張光纖卡接上光纖後,可發現兩個大小一樣的磁碟volunm。
[root@localhost ~]# fdisk -l
Disk /dev/sda: 145.9 GB, 145999527936 bytes
255 heads, 63 sectors/track, 17750 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 33 265041 83 Linux
/dev/sda2 34 2644 20972857+ 83 Linux
/dev/sda3 2645 3949 10482412+ 83 Linux
/dev/sda4 3950 17750 110856532+ 5 Extended
/dev/sda5 3950 5254 10482381 82 Linux swap / Solaris
/dev/sda6 5255 17750 100374088+ 83 Linux
Disk /dev/sdb: 214.3 GB, 214312157184 bytes
255 heads, 63 sectors/track, 26055 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 214.3 GB, 214312157184 bytes
255 heads, 63 sectors/track, 26055 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
4 . 裡用RHEL套件multipathd來處理MPIO問題。
[root@localhost ~]# cp -a /etc/multipath.conf /etc/multipath.conf.bak
[root@localhost ~]# cat /dev/null > /etc/multipath.conf
# vi /etc/multipath.conf
#################### multipath.conf 內容 ##########################
blacklist {
#devnode "*" #所有
devnode "/dev/sda" #本機硬碟不列入multipath偵測範圍
#devnode "/dev/sd[a-c]" #本機硬碟不列入multipath偵測範圍
}
defaults {
user_friendly_names yes
}
# Netapp 附加以下資訊
devices {
device {
vendor "NETAPP"
product "LUN"
path_grouping_policy multibus
getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
prio_callout "/sbin/mpath_prio_netapp /dev/%n"
features "1 queue_if_no_path"
path_checker readsector0
failback immediate
}
}
##################### multipath.conf 內容 結束 ##########################
[root@localhost ~]# service multipathd restart
[root@localhost ~]# chkconfig multipathd on
使用fdisk -l 再次查看設備,發現多出dm-0此valumn設備代號,dm-0此設備代號是不可使用的。
[root@localhost ~]# fdisk -l
Disk /dev/sda: 145.9 GB, 145999527936 bytes
255 heads, 63 sectors/track, 17750 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 33 265041 83 Linux
/dev/sda2 34 2644 20972857+ 83 Linux
/dev/sda3 2645 3949 10482412+ 83 Linux
/dev/sda4 3950 17750 110856532+ 5 Extended
/dev/sda5 3950 5254 10482381 82 Linux swap / Solaris
/dev/sda6 5255 17750 100374088+ 83 Linux
Disk /dev/sdb: 214.3 GB, 214312157184 bytes
255 heads, 63 sectors/track, 26055 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 214.3 GB, 214312157184 bytes
255 heads, 63 sectors/track, 26055 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/dm-0: 214.3 GB, 214312157184 bytes
255 heads, 63 sectors/track, 26055 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-0 doesn't contain a valid partition table
利用multipath 指令,查看可以看到 sdb sdc 兩個volumn對應一個LUM ID,設備代號為mpath1。
[root@localhost ~]# multipath -d -l
mpath1 (360a9800050344433436f61484a306b68) dm-0 NETAPP,LUN
[size=200G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 1:0:0:0 sdb 8:16 [active][undef]
\_ 1:0:1:0 sdc 8:32 [active][undef]
實際查看mpath1設備代號。
[root@localhost ~]# ll /dev/mapper/
total 0
crw------- 1 root root 10, 63 Jan 5 11:38 control
brw-rw---- 1 root disk 253, 0 Jan 5 11:50 mpath1
利用 /dev/mapper/mpath1 來切割磁區。
[root@localhost ~]# fdisk /dev/mapper/mpath1
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table.
The new table will be used at the next reboot.
切割出來的磁區,為/dev/mapper/mpath1p1,但上面警告需要重新開機才可以使用,實際使用partprobe無效,必須要重新開機該設備代號才會出現。
格式化磁區
[root@localhost ~]# mke2fs -j /dev/mapper/mpath1p1
Labels:
Linux