fdisk查看磁盤
[root@db11g ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.9 (Tikanga)
[root@db11g ~]#
[root@db11g ~]#
[root@db11g ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3916 31350847+ 8e Linux LVM
Disk /dev/sdb: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
獲取scsi id
[root@db11g ~]# /sbin/scsi_id -g -u -s /block/sdb
SATA_VBOX_HARDDISK_VB3c0bb909-10aab3a0_
[root@db11g ~]# /sbin/scsi_id -g -u -s /block/sdc
SATA_VBOX_HARDDISK_VB3edd7dc1-fd831bf4_
在RHEL6下使用以下命令
scsi_id --whitelisted --replace-whitespace –-device=/dev/sdb
安裝multipath rpm包
[root@db11g ~]# yum install device-mapper*
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
You can use up2date --register to register.
ULN support will be disabled.
Setting up Install Process
Package device-mapper-multipath-0.4.9-56.0.3.el5.x86_64 already installed and latest version
Package device-mapper-multipath-libs-0.4.9-56.0.3.el5.x86_64 already installed and latest version
Package device-mapper-event-1.02.67-2.el5.x86_64 already installed and latest version
Package device-mapper-1.02.67-2.el5.x86_64 already installed and latest version
Package device-mapper-1.02.67-2.el5.i386 already installed and latest version
Nothing to do
[root@db11g ~]#
[root@db11g ~]#
[root@db11g ~]#
[root@db11g ~]#
[root@db11g ~]# rpm -qa|grep device-mapper
device-mapper-multipath-libs-0.4.9-56.0.3.el5
device-mapper-event-1.02.67-2.el5
device-mapper-1.02.67-2.el5
device-mapper-1.02.67-2.el5
device-mapper-multipath-0.4.9-56.0.3.el5
獲取grid用戶的uid和gid,這裡的gid是asmadmin組的gid
[root@db11g ~]# cat /etc/passwd|grep grid
grid:x:1100:1000:Grid Infrastructure Owner:/home/grid:/bin/bash
[root@db11g ~]# cat /etc/group|grep asmadmin
asmadmin:x:1200:grid,oracle
[root@db11g ~]# id -a grid
uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1200(asmadmin),1201(asmdba),1202(asmoper),1300(dba)
配置/etc/multipath.conf
[root@db11g ~]# cp /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf /etc/
[root@db11g ~]# cat /etc/multipath.conf
defaults {
user_friendly_names no
queue_without_daemon no
flush_on_last_del yes
max_fds max
}
blacklist {
devnode "^hd[a-z]"
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^cciss.*"
}
devices {
device {
vendor "OPNFILER "
product "LUN"
path_grouping_policy group_by_prio
features "3 queue_if_no_path pg_init_retries 50"
getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
path_checker tur
path_selector "round-robin 0"
hardware_handler "1 alua"
failback immediate
rr_weight uniform
rr_min_io 128
}
}
multipaths {
multipath {
wwid SATA_VBOX_HARDDISK_VB3c0bb909-10aab3a0_
alias datadisk
uid 1100
gid 1200
}
multipath {
wwid SATA_VBOX_HARDDISK_VB3edd7dc1-fd831bf4_
alias fradisk
uid 1100
gid 1200
}
}
本欄目更多精彩內容:http://www.bianceng.cn/OS/Linux/
啟動multipath
[root@db11g ~]# modprobe dm-multipath
[root@db11g ~]# modprobe dm-round-robin
[root@db11g ~]# chkconfig multipathd start
[root@db11g ~]# chkconfig multipathd on
[root@db11g ~]# /etc/init.d/multipathd start
Starting multipathd daemon: [ OK ]
[root@db11g ~]# ps -ef|grep multipathd
root 3084 1 0 13:16 ? 00:00:00 /sbin/multipathd
root 3186 2877 0 13:16 pts/0 00:00:00 grep multipathd
[root@db11g ~]# multipath -F
[root@db11g ~]# multipath -v2
Jan 15 13:17:40 | SATA_VBOX_HARDDISK_VBa64c2685-cc2f3dd0_: ignoring map
create: datadisk (SATA_VBOX_HARDDISK_VB3c0bb909-10aab3a0_) undef ATA,VBOX HARDDISK
size=16G features='0' hwhandler='0' wp=undef
`-+- policy='round-robin 0' prio=1 status=undef
- 1:0:0:0 sdb 8:16 undef ready running
create: fradisk (SATA_VBOX_HARDDISK_VB3edd7dc1-fd831bf4_) undef ATA,VBOX HARDDISK
size=10G features='0' hwhandler='0' wp=undef
`-+- policy='round-robin 0' prio=1 status=undef
- 2:0:0:0 sdc 8:32 undef ready running
[root@db11g ~]#
[root@db11g ~]# multipath -ll
fradisk (SATA_VBOX_HARDDISK_VB3edd7dc1-fd831bf4_) dm-3 ATA,VBOX HARDDISK
size=10G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
- 2:0:0:0 sdc 8:32 active ready running
datadisk (SATA_VBOX_HARDDISK_VB3c0bb909-10aab3a0_) dm-2 ATA,VBOX HARDDISK
size=16G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
- 1:0:0:0 sdb 8:16 active ready running
[root@db11g ~]# ll /dev/mapper/*disk
brw-rw---- 1 grid asmadmin 252, 2 Jan 15 13:17 /dev/mapper/datadisk
brw-rw---- 1 grid asmadmin 252, 3 Jan 15 13:17 /dev/mapper/fradisk