|
1 Check whether the package is installed
[Root @ pcvmaster ~] # rpm -qa | grep device-mapper
device-mapper-libs-1.02.74-10.el6.x86_64
device-mapper-event-libs-1.02.74-10.el6.x86_64
device-mapper-multipath-0.4.9-56.el6.x86_64
device-mapper-1.02.74-10.el6.x86_64
device-mapper-event-1.02.74-10.el6.x86_64
device-mapper-multipath-libs-0.4.9-56.el6.x86_64
2 Install multipath
[Root @ pcvmaster ~] # yum -yinstall multipath
3 boot
[Root @ pcvmaster ~] # chkconfigmultipathd on
4 Edit the multipath configuration file
vi /etc/multipath.conf
# This is a basicconfiguration file with some examples, for device mapper
# Multipath.
# For a complete list of thedefault configuration values, see
# / Usr / share / doc / device-mapper-multipath-0.4.9 / multipath.conf.defaults
# For a list of configurationoptions with descriptions, see
# / Usr / share / doc / device-mapper-multipath-0.4.9 / multipath.conf.annotated
#
# REMEMBER: After updatingmultipath.conf, you must run
#
# Service multipathd reload
#
# For the changes to takeeffect in multipathd
## By default, devices withvendor = "IBM" and product = "S / 390. *" are
## Blacklisted. To enablemulitpathing on these devies, uncomment the
## Following lines.
#blacklist_exceptions {
# Device {
# Vendor "IBM"
# Product "S / 390. *"
#}
#}
## Use user friendly names, instead of using WWIDs as names.
defaults {
user_friendly_names yes
}
##
## Here is an example of howto configure some standard options.
##
#
#defaults {
# Udev_dir / dev
# Polling_interval 10
# Selector "round-robin0"
# Path_grouping_policy multibus
# Getuid_callout "/ lib / udev / scsi_id - whitelisted --device = / dev /% n"
# Prio alua
# Path_checker readsector0
# Rr_min_io 100
# Max_fds 8192
# Rr_weight priorities
# Failback immediate
# No_path_retry fail
# User_friendly_names yes
#}
##
## The wwid line in thefollowing blacklist section is shown as an example
## Of how to blacklistdevices by wwid. The 2 devnode lines arethe
## Compiled in defaultblacklist. If you want to blacklist entire types
## Of devices, such as allscsi devices, you should use a devnode line.
## However, if you want toblacklist specific devices, you should use
## A wwid line. Since there is no guarantee that a specificdevice will
## Not change names on reboot (from / dev / sda to / dev / sdb for example)
## Devnode lines are notrecommended for blacklisting specific devices.
##
#blacklist {
# Wwid 26353900f02796769
# Devnode "^ (ram | raw | loop | fd | md | dm- | sr | scd | st) [0-9] *"
# Devnode "^ hd [a-z]"
#}
#multipaths {
# Multipath {
# Wwid 3600508b4000156d700012000000b0000
# Alias yellow
# Path_grouping_policy multibus
# Path_checker readsector0
# Path_selector "round-robin0"
# Failback manual
# Rr_weight priorities
# No_path_retry 5
#}
# Multipath {
# Wwid 1DEC_____321816758474
# Alias red
#}
#}
#devices {
# Device {
# Vendor "COMPAQ"
# Product "HSV110 (C) COMPAQ"
# Path_grouping_policy multibus
# Getuid_callout "/ lib / udev / scsi_id --whitelisted --device = / dev /% n"
# Path_checker readsector0
# Path_selector "round-robin0"
# Hardware_handler "0"
# Failback 15
# Rr_weight priorities
# No_path_retry queue
#}
# Device {
# Vendor "COMPAQ"
# Product "MSA1000"
# Path_grouping_policy multibus
#}
#}
blacklist {
devnode "^ (ram | raw | loop | fd | md | dm- | sr | sr | scd | st) [0-9] *"
devnode "^ hd [a-z]"
}
devices {
device {
vendor "Netapp"
path_grouping_policymultibus
features "1queue_if_no_path"
path_checkerreadsector ()
failback immediate
}
}
5 Start Service
[Root @ pcvmaster ~] # / etc / init.d / multipathd start
6 Delete the existing path is not used
[Root @ pcvmaster ~] # multipath-F
7 formatted path detection path, the path merge
[Root @ pcvmaster ~] # multipath-v2
8 See multipath conditions
[Root @ pcvmaster ~] # multipath-ll
9 Reboot the system
[Root @ pcvmaster ~] # reboot
10 Creating PV multiple disks,
[Root @ pcvmaster ~] # pvcreate / dev / mapper / mpath {d, f, e, p, t, k, j, c, s, q}
11 add multiple disks to Volbackup
[Root @ pcvmaster ~] # vgcreateVolbackup / dev / mapper / mpath {d, f, e, p, t, k, j, c, s, q}
12 Creating LV
[Root @ pcvmaster ~] # lvcreate-l 1310780 -n LogVol01 Volbackup
13 Formatting LV
[Root @ pcvmaster ~] mkfs.ext4 / dev / Volbackup / LogVol01
14 Mount
[Root @ pcvmaster ~] # mount / dev / Volbackup / LogVol01 / backup
15FAQ
15.1 After the module is not loaded successfully
If the module is not loaded successfully use the following command to initialize DM, or reboot the system
--- Use thefollowing commands to initialize and start DM for the first time:
# Modprobedm-multipath
# Modprobe dm-round-robin
# Servicemultipathd start
# Multipath -v2
15.2 multipath principle introduction
1, device-mapper-multipath: namely multipath-tools. Multipathd and mainly provides tools such as multipath and multipath.conf and other configuration files. These tools of ioctr device mapper interface to create and configure multipath devices (call the user-space library of device-mapper. Multipath devices will be created in the / dev / mapper in).
2, device-mapper: includes two parts: the core part and a user part. The main part of the kernel from the device mapper kernel (dm.ko) and some of the target driver (md-multipath.ko). Core complete the mapping device, and target specific processing device down from mappered i / o according to the mapping relationship and its own characteristics. Meanwhile, in the central part, provides an interface, users can ioctr and kernel part of the communication, to guide the kernel driver behavior, such as how to create mappered device, the properties of these divece like. User-space portion linux device mapper mainly include device-mapper package. Including dmsetup tools and some help to create and configure mappered device libraries. These libraries mainly abstraction, encapsulation interface ioctr communication with, easy to create and configure mappered device. multipath-tool program you need to call these libraries.
3, dm-multipath.ko and dm.ko: dm.ko is devicemapper drive. It is the basis of multipath. dm dm-multipath is actually a target drive.
4, scsi_id: udev included in the package, you can configure the program to get the numbers in multipath.conf scsi device. By number, you can determine a plurality of paths corresponding to the same device. This is the key to multi-path implementation. scsi_id by sg driver, or sent to the device EVPD page80 page83 of inquery command to query identifies scsi devices. However, some devices do not support EVPD of inquery command, so they can not be used to generate multipath devices. But can be rewritten scsi_id, it was unable to provide a virtual scsi device identification of a device identifier, and output to standard output. multipath program when creating multipath devices, calls scsi_id, get scsi id of the device from its standard output. When rewriting scsi_id need to modify the program returns 0. Because multipath program checks to determine whether the direct scsi id has been successfully obtained. |
|
|
|