Show Table of Contents
章 3. 設定 DM Multipath
本章的範例會逐步帶領您配置 DM Multipath。其中包含了以下程序:
- 基本 DM Multipath 設定
- 忽略本機磁碟
- 新增更多裝置至配置檔案中
- 在
initramfs檔案系統中啟用 multipath
3.1. 設定 DM Multipath
要在系統上設定 DM Multipath 之前,請確定您的系統已安裝
device-mapper-multipath 套件,或已更新至最新版。
您透過
mpathconf 工具程式來設定 multipath,這將會建立 multipath 配置檔案 /etc/multipath.conf。
- 若
/etc/multipath.conf檔案已存在,mpathconf工具程式便會編輯該檔案。 - 若
/etc/multipath.conf檔案不存在的話,mpathconf工具程式將會使用/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf檔案來作為起始檔案。 - 若
/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf檔案不存在的話,mpathconf工具程式將會重新建立一個/etc/multipath.conf檔案。
若您不需要編輯
/etc/multipath.conf 檔案,您可透過執行下列指令來為基本備援配置設定 DM Multipath。這項指令將啟用 multipath 配置檔案並啟動 multipathd daemon。
# mpathconf --enable --with_multipathd y
若您在啟動
multipathd daemon 之前,需要編輯 /etc/multipath.conf 檔案的話,請使用下列程序來為基本備援配置設定 DM Multipath。
- 請執行
mpathconf指令,並指定--enable選項:#
mpathconf --enable欲取得更多有關於mpathconf指令選項上的相關資訊,您可能需要參閱mpathconf的 man page 或是執行mpathconf指令並指定--help選項。#
mpathconf --helpusage: /sbin/mpathconf <command> Commands: Enable: --enable Disable: --disable Set user_friendly_names (Default y): --user_friendly_names <y|n> Set find_multipaths (Default y): --find_multipaths <y|n> Load the dm-multipath modules on enable (Default y): --with_module <y|n> start/stop/reload multipathd (Default n): --with_multipathd <y|n> - 請視需求編輯
/etc/multipath.conf檔案。DM Multipath 的預設設定會被編譯入系統中,並且無須明確地設置於/etc/multipath.conf檔案中。path_grouping_policy的預設值設為failover,因此在本範例中,您無須編輯/etc/multipath.conf檔案。欲取得如何將配置檔案中的預設值改為其它值的相關資訊,請參閱〈章 4, DM Multipath 配置檔案〉。配置檔案的初始預設值一節會將 multipath 裝置名稱設為mpathn 這個格式;若沒有這項設定,multipath 裝置的名稱將會是裝置 WWID 的別名。 - 視需求儲存配置檔案並退出文字編輯器。
- 執行下列指令:
#
service multipathd start
由於配置檔案中,
user_friendly_name 的值被設為了 yes,因此 multipath 裝置會以 /dev/mapper/mpathn 格式被建立。欲取得如何為裝置名稱設置別名的相關資訊,請參閱〈章 4, DM Multipath 配置檔案〉。
若您不希望採用使用者容易記得的名稱,您可執行下列指令:
# mpathconf --enable --user_friendly_names n注意
如果您需要在 multipath darmon 啟動後編輯 multipath 配置檔,那麼在編輯後請務必執行
service multipathd reload 指令,好讓變更生效。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.