編輯 /etc/multipath.conf
把 blacklist {} 區段註解掉
然後把 default{} 區段打開
chkconfig multipathd on
service multipathd start
然後 fdisk -l 會看到多出 dm-n 的硬碟 但 dm-n 不能直接掛來用
要用 /dev/mapper/mpathNpN
詳細資料待查
引用
#vi /etc/multipath.conf
然後可以看到檔案裡面有這些東西
blacklist {
devnode "*"
}
把這幾行mark掉吧
devnode "*"
}
把這幾行mark掉吧
另外可以看到有一些本來被mark掉的
#defaults {
# udev_dir /dev
# polling_interval 10
# selector "round-robin 0"
# path_grouping_policy multibus
# getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
# prio_callout /bin/true
# path_checker readsector0
# rr_min_io 100
# max_fds 8192
# rr_weight priorities
# failback immediate
# no_path_retry fail
# user_friendly_names yes
#}
# udev_dir /dev
# polling_interval 10
# selector "round-robin 0"
# path_grouping_policy multibus
# getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
# prio_callout /bin/true
# path_checker readsector0
# rr_min_io 100
# max_fds 8192
# rr_weight priorities
# failback immediate
# no_path_retry fail
# user_friendly_names yes
#}
這裡是設定一些multipath參數的地方
設定好就拿掉mark吧,如果不會設定的話直接拿掉mark也是可以的
存檔後就可以開啟service了
#chkconfig multipathd on
#service multipathd start
在啟動之前可以看到我硬碟是這樣
Disk /dev/sdb: 997.9 GB, 997999509504 bytes
255 heads, 63 sectors/track, 121333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1306 10490413+ 83 Linux
/dev/sdb2 1307 2612 10490445 83 Linux
Disk /dev/sdc: 997.9 GB, 997999509504 bytes
255 heads, 63 sectors/track, 121333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 1306 10490413+ 83 Linux
/dev/sdc2 1307 2612 10490445 83 Linux
啟動之後可以看到多出幾個device
255 heads, 63 sectors/track, 121333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1306 10490413+ 83 Linux
/dev/sdb2 1307 2612 10490445 83 Linux
Disk /dev/sdc: 997.9 GB, 997999509504 bytes
255 heads, 63 sectors/track, 121333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 1306 10490413+ 83 Linux
/dev/sdc2 1307 2612 10490445 83 Linux
啟動之後可以看到多出幾個device
Disk /dev/dm-0: 997.9 GB, 997999509504 bytes
255 heads, 63 sectors/track, 121333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/dm-0p1 * 1 1306 10490413+ 83 Linux
/dev/dm-0p2 1307 2612 10490445 83 Linux
Disk /dev/dm-1: 10.7 GB, 10742183424 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-1 doesn't contain a valid partition table
Disk /dev/dm-2: 10.7 GB, 10742215680 bytes
255 heads, 63 sectors/track, 1306 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-2 doesn't contain a valid partition table
其中dm-0是sdb和sdc的合體,但是因為sdb和sdc有兩個partition,
255 heads, 63 sectors/track, 121333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/dm-0p1 * 1 1306 10490413+ 83 Linux
/dev/dm-0p2 1307 2612 10490445 83 Linux
Disk /dev/dm-1: 10.7 GB, 10742183424 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-1 doesn't contain a valid partition table
Disk /dev/dm-2: 10.7 GB, 10742215680 bytes
255 heads, 63 sectors/track, 1306 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-2 doesn't contain a valid partition table
其中dm-0是sdb和sdc的合體,但是因為sdb和sdc有兩個partition,
所以multipath也順便把這兩個合成dm-1和dm-2,
這時候會發現在device下面找不到dm-0p1和dm-0p2可以用,
因為他放到/dev/mapper裡面去了,在裡面可以看到mpath1p1和mpath1p2分別就是兩個partition
如果要更改設定的話除了在multipath.conf裡面更改再重新啟動之外
也可以用multipath指令即時更新,另外"multipath -ll"也可以看到目前path的組成以及狀況
參考
http://tnth.pixnet.net/blog/post/26222957-linux%E4%B8%8A%E7%9A%84mpio
https://access.redhat.com/documentation/zh-TW/Red_Hat_Enterprise_Linux/6/html/DM_Multipath/mpio_setup.html