iscsi挂载存储
rpm -ivh iscsi-initiator-utils-6.2.0.873-10.el6.x86_64.rpm #安装iscsi包
service iscsi start
service iscsid start
修改开机自动发现iscsi存储
vim /etc/iscsi/initiatorname.iscsi #修改iqn
InitiatorName=iqn.2006-01.com.openfiler:tsn.6041375b138b #虚拟存储id
发现存储
iscsiadm -m discovery -t st -p 192.168.3.231:3260 #存储ip地址
登录多路径存储
iscsiadm -m node --loginall=all #全部登陆
iscsiadm -m session #查看登陆路径
tcp: [1] 192.168.3.231:3260,1 iqn.2006-01.com.openfiler:tsn.6041375b138b
tcp: [2] 192.168.3.232:3260,1 iqn.2006-01.com.openfiler:tsn.6041375b138b
tcp: [3] 192.168.3.233:3260,1 iqn.2006-01.com.openfiler:tsn.6041375b138b
tcp: [4] 192.168.3.234:3260,1 iqn.2006-01.com.openfiler:tsn.6041375b138b
过滤查看多路径磁盘
fdisk -l
fdisk -l|grep "10.7 GB" #过滤10.7 GB容量磁盘
Disk /dev/sdd: 10.7 GB, 10737418240 bytes
Disk /dev/sde: 10.7 GB, 10737418240 bytes
Disk /dev/sdg: 10.7 GB, 10737418240 bytes
Disk /dev/sdj: 10.7 GB, 10737418240 bytes
multipath多路径安装配置
rpm -ivh device-mapper-1.02.79-8.el6.x86_64.rpm
rpm -ivh device-mapper-multipath-libs-0.4.9-72.el6.x86_64.rpm
rpm -ivh device-mapper-multipath-0.4.9-72.el6.x86_64.rpm
检查内核文件
modprobe -l |grep multipath
multipath -ll #查看多路径状态
过滤磁盘并记录多路径磁盘 盘符
fdisk -l|grep "10.7 GB"
Disk /dev/sdd: 10.7 GB, 10737418240 bytes
Disk /dev/sde: 10.7 GB, 10737418240 bytes
Disk /dev/sdh: 10.7 GB, 10737418240 bytes
Disk /dev/sdi: 10.7 GB, 10737418240 bytes
编辑配置文件
cp /etc/multipath.conf /etc/multipath.conf.bak
echo > /etc/multipath.conf
vim /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths yes
}
blacklist {
wwid 36000c29cb6821173f0fc0f7a6142814d
}
multipaths {
multipath {
wwid 14f504e46494c4552496f626d72502d346a724c2d69774353
alias oracle-fs01
path_grouping_policy multibus
path_selector "round-robin 0"
failback immediate
}
multipath {
wwid 14f504e46494c4552776f684d78732d6e444a702d306a6661
alias oracle-fs02
path_grouping_policy multibus
path_selector "round-robin 0"
failback immediate
}
}
devices {
device {
vendor "openfiler"
product "virtual disk"
path_grouping_policy multibus
path_checker readsector0
path_selector "round-robin 0"
hardware_handler "0"
}
}
删除当前多路径并重建多路径
multipath -F #删除当前多路径
multipath -v2 #重建当前多路径
multipath -ll #查看当前多路径状态
格式化并分区多路径磁盘
分区多路径磁盘
fdisk -l|grep /dev/mapper
fdisk -c /dev/mapper/oracle-fs01
mkfs.ext4 /dev/mapper/oracle-fs01p1
df -Th #查看磁盘
编辑开机文件并加入开机自动挂载磁盘
vim /etc/fstab
/dev/mapper/oracle-fs01p1 /data01 ext4 defaults 0 0
/dev/mapper/oracle-fs02p1 /data02 ext4 defaults 0 0
重启主机
reboot