中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Linux Multipath多路徑配置以及使用分析

發布時間:2021-11-05 17:32:53 來源:億速云 閱讀:229 作者:柒染 欄目:建站服務器

本篇文章給大家分享的是有關Linux Multipath多路徑配置以及使用分析,小編覺得挺實用的,因此分享給大家學習,希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。


Linux Multipath多路徑配置以及使用分析


   在Linux平臺一部分存儲產品使用操作系統自帶的多路徑軟件,包括最常見的HP和IBM的部分存儲產品,在Linux自帶的多路徑軟件叫做multipath,這篇文章以HP EVA系列存儲在Linux平臺的使用為例,詳細的在Linux平臺配置和使用多路徑。

那么問題就來了,到底什么是多路徑?

普通的電腦主機都是一個硬盤掛接到一個總線上,這里是一對一的關系。而到了有光纖組成的SAN環境,或者由iSCSI組成的IPSAN環境,由于主機和存儲通過了光纖交換機或者多塊網卡及IP來連接,這樣的話,就構成了多對多的關系。也就是說,主機到存儲可以有多條路徑可以選擇。主機到存儲之間的IO由多條路徑可以選擇。每個主機到所對應的存儲可以經過幾條不同的路徑,如果是同時使用的話,I/O流量如何分配?其中一條路徑壞掉了,如何處理?從在操作系統的角度來看,每條路徑,操作系統會認為是一個實際存在的物理盤,但實際上只是通向同一個物理盤的不同路徑而已,這樣是在使用的時候,就給用戶帶來了困惑。多路徑軟件就是為了解決上面的問題應運而生的。

多路徑的主要功能就是和存儲設備一起配合實現如下功能: 
1、故障的切換和恢復 
2、IO流量的負載均衡 
3、磁盤的虛擬化 
   

由于多路徑軟件是需要和存儲在一起配合使用的,不同的廠商基于不同的操作系統,都提供了不同的版本。并且有的廠商,軟件和硬件也不是一起賣的,如果要使用多路徑軟件的話,可能還需要向廠商購買license才行。比如EMC公司基于linux下的多路徑軟件,就需要單獨的購買license。好在, RedHat和Suse的2.6的內核中都自帶了免費的多路徑軟件包,并且可以免費使用,同時也是一個比較通用的包,可以支持大多數存儲廠商的設備,即使是一些不是出名的廠商,通過對配置文件進行稍作修改,也是可以支持并運行的很好的。

一、Linux下multipath介紹

在redhat中,安裝操作系統的時候multipath已經默認被安裝,查看安裝情況:

[root@seaing ~]# rpm -qa | grep device-mapper

device-mapper-multipath-0.4.7-34.el5

device-mapper-1.02.39-1.el5

device-mapper-1.02.39-1.el5

device-mapper-event-1.02.39-1.el5

1、device-mapper-multipath:即multipath-tools。主要提供multipathd和multipath等工具和 multipath.conf等配置文件。這些工具通過device mapper的ioctr的接口創建和配置multipath設備(調用device-mapper的用戶空間庫。創建的多路徑設備會在/dev /mapper中)。

2、 device-mapper:主要包括兩大部分:內核部分和用戶部分。內核部分主要由device mapper核心(dm.ko)和一些target driver(md-multipath.ko)。核心完成設備的映射,而target根據映射關系和自身特點具體處理從mappered device 下來的i/o。同時,在核心部分,提供了一個接口,用戶通過ioctr可和內核部分通信,以指導內核驅動的行為,比如如何創建mappered device,這些divece的屬性等。linux device mapper的用戶空間部分主要包括device-mapper這個包。其中包括dmsetup工具和一些幫助創建和配置mappered device的庫。這些庫主要抽象,封裝了與ioctr通信的接口,以便方便創建和配置mappered device。multipath-tool的程序中就需要調用這些庫。 

3、dm-multipath.ko和dm.ko:dm.ko是device mapper驅動。它是實現multipath的基礎。dm-multipath其實是dm的一個target驅動。 

4、scsi_id: 包含在udev程序包中,可以在multipath.conf中配置該程序來獲取scsi設備的序號。通過序號,便可以判斷多個路徑對應了同一設備。這個是多路徑實現的關鍵。scsi_id是通過sg驅動,向設備發送EVPD page80或page83 的inquery命令來查詢scsi設備的標識。但一些設備并不支持EVPD 的inquery命令,所以他們無法被用來生成multipath設備。但可以改寫scsi_id,為不能提供scsi設備標識的設備虛擬一個標識符,并輸出到標準輸出。multipath程序在創建multipath設備時,會調用scsi_id,從其標準輸出中獲得該設備的scsi id。在改寫時,需要修改scsi_id程序的返回值為0。因為在multipath程序中,會檢查該直來確定scsi id是否已經成功得到。

想了解更多關于Device Mapper Multipath(DM-Multipath),請參考博文:http://blog.csdn.net/holandstone/article/details/7050234

 

二、Linux下multipath詳細配置

首先,我們本次Linux下multipath的整體的拓撲結構,如下所示:
Linux Multipath多路徑配置以及使用分析 

因為在安裝操作系統的時候,multipath的軟件包已經那裝好了,所以這里就不在需要安裝,如果沒有安裝的話,需要手動的進行安裝。

1、檢查安裝是否正常

[root@seaing ~]# lsmod |grep dm_multipath

dm_multipath           56921  2 dm_round_robin

scsi_dh                42177  1 dm_multipath

dm_mod                101649  19 dm_multipath,dm_raid45,dm_snapshot,dm_zero,dm_mirror,dm_log

如果模塊沒有加載成功,請使用下面的命令初始化DM:

[root@seaing ~]#modprobe dm-multipath 
[root@seaing ~]#modprobe dm-round-robin 
[root@seaing ~]#service multipathd start 
[root@seaing ~]#multipath –v2

2、編輯配置文件

[root@seaing ~]# cat /etc/multipath.conf

blacklist {

        devnode "^sda"

        }

defaults {

        user_friendly_names no

        }

multipaths {

        multipath {

                wwid                    3600508b4000892b90002a00000050000 #磁盤的WWID

                alias                   comsys-dm0  #映射后的別名,自己命名

                path_grouping_policy    multibus    #路徑組策略

                path_checker            tur         #決定路徑狀態的方法

                path_selector           "round-robin 0"  #選擇那一條路徑進行下次IO操作

                }

        multipath {

                wwid                    3600508b4000892b90002a00000090000

                alias                   comsys-dm1

                path_grouping_policy    multibus

                path_checker            tur

                path_selector           "round-robin 0"

                }

        multipath {

                wwid                    3600508b4000892b90002a00000140000

                alias                   comsys-backup

                path_grouping_policy    multibus

                path_checker            tur

                path_selector           "round-robin 0"

                }

        }

devices {

        device {

                vendor                  "HP"                                #廠商名稱,可通過multipath –v3獲取到

                product                 "HSV300"                            #產品型號

                path_grouping_policy    multibus                            #默認的路徑組策略

                getuid_callout          "/sbin/scsi_id -g -u -s /block/%n"  #獲得唯一設備號使用的默認程序

                path_checker            readsector0                         #決定路徑狀態的方法

                path_selector           "round-robin 0"                     #選擇那條路徑進行下一個IO操作的方法

                  #failback        immediate                                #故障恢復的模式

        #no_path_retry      queue                                           #在disable queue之前系統嘗試使用失效路徑的次數的數值

        #rr_min_io         100                                              #在當前的用戶組中,在切換到另外一條路徑之前的IO請求的數目

                }

        }

備注:

其中 wwid,vendor,product, getuid_callout這些參數可以通過:multipath -v3命令來獲取。如果在/etc/multipath.conf中有設定各wwid別名,別名會覆蓋此設定。

下面是兩種方法來獲取WWID
(1)默認情況下,將使用 /var/lib/multipath/bindings 內的配置設定具體每個多路徑設備名,如果在/etc/multipath.conf中有設定各wwid 別名,別名會覆蓋此設定。
[root@seaing ~]# cat /var/lib/multipath/bindings
# Multipath bindings, Version : 1.0
# NOTE: this file is automatically maintained by the multipath program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# alias wwid
#
mpath0 SATA_WDC_WD5003ABYX-_WD-WMAYP4135415
mpath2 3600508b4000892b90002a00000050000
mpath3 3600508b4000892b90002a00000090000


(2)通過multipath -v3命令來獲取

[root@seaing ~]# multipath -v3

dm-0: blacklisted

dm-1: blacklisted

dm-2: blacklisted

dm-3: blacklisted

dm-4: blacklisted

loop0: blacklisted

loop1: blacklisted

loop2: blacklisted

loop3: blacklisted

loop4: blacklisted

loop5: blacklisted

loop6: blacklisted

loop7: blacklisted

md0: blacklisted

ram0: blacklisted

ram10: blacklisted

ram11: blacklisted

ram12: blacklisted

ram13: blacklisted

ram14: blacklisted

ram15: blacklisted

ram1: blacklisted

ram2: blacklisted

ram3: blacklisted

ram4: blacklisted

ram5: blacklisted

ram6: blacklisted

ram7: blacklisted

ram8: blacklisted

ram9: blacklisted

sda: blacklisted

sdb: not found in pathvec

sdb: mask = 0x1f

sdb: bus = 1

sdb: dev_t = 8:16

sdb: size = 209715200

sdb: vendor = HP

sdb: product = HSV300

sdb: rev = 0952

sdb: h:b:t:l = 4:0:0:1

sdb: tgt_node_name = 0x50014380013be3f0

sdb: serial = P5512G29SVP02Q

sdb: path checker = readsector0 (controller setting)

sdb: checker timeout = 60000 ms (sysfs setting)

sdb: state = 2

sdb: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sdb: uid = 3600508b4000892b90002a00000050000 (callout)

sdb: getprio = NULL (internal default)

sdb: prio = 1

sdc: not found in pathvec

sdc: mask = 0x1f

sdc: bus = 1

sdc: dev_t = 8:32

sdc: size = 419430400

sdc: vendor = HP

sdc: product = HSV300

sdc: rev = 0952

sdc: h:b:t:l = 4:0:0:2

sdc: tgt_node_name = 0x50014380013be3f0

sdc: serial = P5512G29SVP02Q

sdc: path checker = readsector0 (controller setting)

sdc: checker timeout = 60000 ms (sysfs setting)

sdc: state = 2

sdc: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sdc: uid = 3600508b4000892b90002a00000090000 (callout)

sdc: getprio = NULL (internal default)

sdc: prio = 1

sdd: not found in pathvec

sdd: mask = 0x1f

sdd: bus = 1

sdd: dev_t = 8:48

sdd: size = 209715200

sdd: vendor = HP

sdd: product = HSV300

sdd: rev = 0952

sdd: h:b:t:l = 4:0:0:3

sdd: tgt_node_name = 0x50014380013be3f0

sdd: serial = P5512G29SVP02Q

sdd: path checker = readsector0 (controller setting)

sdd: checker timeout = 60000 ms (sysfs setting)

sdd: state = 2

sdd: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sdd: uid = 3600508b4000892b90002a00000140000 (callout)

sdd: getprio = NULL (internal default)

sdd: prio = 1

sde: not found in pathvec

sde: mask = 0x1f

sde: bus = 1

sde: dev_t = 8:64

sde: size = 209715200

sde: vendor = HP

sde: product = HSV300

sde: rev = 0952

sde: h:b:t:l = 4:0:1:1

sde: tgt_node_name = 0x50014380013be3f0

sde: serial = P5512G29SVP01O

sde: path checker = readsector0 (controller setting)

sde: checker timeout = 60000 ms (sysfs setting)

sde: state = 2

sde: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sde: uid = 3600508b4000892b90002a00000050000 (callout)

sde: getprio = NULL (internal default)

sde: prio = 1

sdf: not found in pathvec

sdf: mask = 0x1f

sdf: bus = 1

sdf: dev_t = 8:80

sdf: size = 419430400

sdf: vendor = HP

sdf: product = HSV300

sdf: rev = 0952

sdf: h:b:t:l = 4:0:1:2

sdf: tgt_node_name = 0x50014380013be3f0

sdf: serial = P5512G29SVP01O

sdf: path checker = readsector0 (controller setting)

sdf: checker timeout = 60000 ms (sysfs setting)

sdf: state = 2

sdf: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sdf: uid = 3600508b4000892b90002a00000090000 (callout)

sdf: getprio = NULL (internal default)

sdf: prio = 1

sdg: not found in pathvec

sdg: mask = 0x1f

sdg: bus = 1

sdg: dev_t = 8:96

sdg: size = 209715200

sdg: vendor = HP

sdg: product = HSV300

sdg: rev = 0952

sdg: h:b:t:l = 4:0:1:3

sdg: tgt_node_name = 0x50014380013be3f0

sdg: serial = P5512G29SVP01O

sdg: path checker = readsector0 (controller setting)

sdg: checker timeout = 60000 ms (sysfs setting)

sdg: state = 2

sdg: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sdg: uid = 3600508b4000892b90002a00000140000 (callout)

sdg: getprio = NULL (internal default)

sdg: prio = 1

sdh: not found in pathvec

sdh: mask = 0x1f

sdh: bus = 1

sdh: dev_t = 8:112

sdh: size = 209715200

sdh: vendor = HP

sdh: product = HSV300

sdh: rev = 0952

sdh: h:b:t:l = 5:0:0:1

sdh: tgt_node_name = 0x50014380013be3f0

sdh: serial = P5512G29SVP02Q

sdh: path checker = readsector0 (controller setting)

sdh: checker timeout = 60000 ms (sysfs setting)

sdh: state = 2

sdh: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sdh: uid = 3600508b4000892b90002a00000050000 (callout)

sdh: getprio = NULL (internal default)

sdh: prio = 1

sdi: not found in pathvec

sdi: mask = 0x1f

sdi: bus = 1

sdi: dev_t = 8:128

sdi: size = 419430400

sdi: vendor = HP

sdi: product = HSV300

sdi: rev = 0952

sdi: h:b:t:l = 5:0:0:2

sdi: tgt_node_name = 0x50014380013be3f0

sdi: serial = P5512G29SVP02Q

sdi: path checker = readsector0 (controller setting)

sdi: checker timeout = 60000 ms (sysfs setting)

sdi: state = 2

sdi: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sdi: uid = 3600508b4000892b90002a00000090000 (callout)

sdi: getprio = NULL (internal default)

sdi: prio = 1

sdj: not found in pathvec

sdj: mask = 0x1f

sdj: bus = 1

sdj: dev_t = 8:144

sdj: size = 209715200

sdj: vendor = HP

sdj: product = HSV300

sdj: rev = 0952

sdj: h:b:t:l = 5:0:0:3

sdj: tgt_node_name = 0x50014380013be3f0

sdj: serial = P5512G29SVP02Q

sdj: path checker = readsector0 (controller setting)

sdj: checker timeout = 60000 ms (sysfs setting)

sdj: state = 2

sdj: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sdj: uid = 3600508b4000892b90002a00000140000 (callout)

sdj: getprio = NULL (internal default)

sdj: prio = 1

sdk: not found in pathvec

sdk: mask = 0x1f

sdk: bus = 1

sdk: dev_t = 8:160

sdk: size = 209715200

sdk: vendor = HP

sdk: product = HSV300

sdk: rev = 0952

sdk: h:b:t:l = 5:0:1:1

sdk: tgt_node_name = 0x50014380013be3f0

sdk: serial = P5512G29SVP01O

sdk: path checker = readsector0 (controller setting)

sdk: checker timeout = 60000 ms (sysfs setting)

sdk: state = 2

sdk: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sdk: uid = 3600508b4000892b90002a00000050000 (callout)

sdk: getprio = NULL (internal default)

sdk: prio = 1

sdl: not found in pathvec

sdl: mask = 0x1f

sdl: bus = 1

sdl: dev_t = 8:176

sdl: size = 419430400

sdl: vendor = HP

sdl: product = HSV300

sdl: rev = 0952

sdl: h:b:t:l = 5:0:1:2

sdl: tgt_node_name = 0x50014380013be3f0

sdl: serial = P5512G29SVP01O

sdl: path checker = readsector0 (controller setting)

sdl: checker timeout = 60000 ms (sysfs setting)

sdl: state = 2

sdl: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sdl: uid = 3600508b4000892b90002a00000090000 (callout)

sdl: getprio = NULL (internal default)

sdl: prio = 1

sdm: not found in pathvec

sdm: mask = 0x1f

sdm: bus = 1

sdm: dev_t = 8:192

sdm: size = 209715200

sdm: vendor = HP

sdm: product = HSV300

sdm: rev = 0952

sdm: h:b:t:l = 5:0:1:3

sdm: tgt_node_name = 0x50014380013be3f0

sdm: serial = P5512G29SVP01O

sdm: path checker = readsector0 (controller setting)

sdm: checker timeout = 60000 ms (sysfs setting)

sdm: state = 2

sdm: getuid = /sbin/scsi_id -g -u -s /block/%n (controller setting)

sdm: uid = 3600508b4000892b90002a00000140000 (callout)

sdm: getprio = NULL (internal default)

sdm: prio = 1

sr0: blacklisted

===== paths list =====

uuid                              hcil    dev dev_t pri dm_st  chk_st  vend/pr

3600508b4000892b90002a00000050000 4:0:0:1 sdb 8:16  1   [undef][ready] HP,HSV3

3600508b4000892b90002a00000090000 4:0:0:2 sdc 8:32  1   [undef][ready] HP,HSV3

3600508b4000892b90002a00000140000 4:0:0:3 sdd 8:48  1   [undef][ready] HP,HSV3

3600508b4000892b90002a00000050000 4:0:1:1 sde 8:64  1   [undef][ready] HP,HSV3

3600508b4000892b90002a00000090000 4:0:1:2 sdf 8:80  1   [undef][ready] HP,HSV3

3600508b4000892b90002a00000140000 4:0:1:3 sdg 8:96  1   [undef][ready] HP,HSV3

3600508b4000892b90002a00000050000 5:0:0:1 sdh 8:112 1   [undef][ready] HP,HSV3

3600508b4000892b90002a00000090000 5:0:0:2 sdi 8:128 1   [undef][ready] HP,HSV3

3600508b4000892b90002a00000140000 5:0:0:3 sdj 8:144 1   [undef][ready] HP,HSV3

3600508b4000892b90002a00000050000 5:0:1:1 sdk 8:160 1   [undef][ready] HP,HSV3

3600508b4000892b90002a00000090000 5:0:1:2 sdl 8:176 1   [undef][ready] HP,HSV3

3600508b4000892b90002a00000140000 5:0:1:3 sdm 8:192 1   [undef][ready] HP,HSV3

params = 0 0 1 1 round-robin 0 4 1 8:32 1000 8:80 1000 8:128 1000 8:176 1000

status = 2 0 0 0 1 1 A 0 4 0 8:32 A 0 8:80 A 0 8:128 A 0 8:176 A 0

params = 0 0 1 1 round-robin 0 4 1 8:16 1000 8:64 1000 8:112 1000 8:160 1000

status = 2 0 0 0 1 1 A 0 4 0 8:16 A 0 8:64 A 0 8:112 A 0 8:160 A 0

params = 0 0 1 1 round-robin 0 4 1 8:48 1000 8:96 1000 8:144 1000 8:192 1000

status = 2 0 0 0 1 1 A 0 4 0 8:48 A 0 8:96 A 0 8:144 A 0 8:192 A 0

sdb: ownership set to comsys-dm0

sdb: not found in pathvec

sdb: mask = 0xc

sdb: state = 2

sdb: prio = 1

sde: ownership set to comsys-dm0

sde: not found in pathvec

sde: mask = 0xc

sde: state = 2

sde: prio = 1

sdh: ownership set to comsys-dm0

sdh: not found in pathvec

sdh: mask = 0xc

sdh: state = 2

sdh: prio = 1

sdk: ownership set to comsys-dm0

sdk: not found in pathvec

sdk: mask = 0xc

sdk: state = 2

sdk: prio = 1

comsys-dm0: pgfailover = -1 (internal default)

comsys-dm0: pgpolicy = multibus (LUN setting)

comsys-dm0: selector = round-robin 0 (LUN setting)

comsys-dm0: features = 0 (internal default)

comsys-dm0: hwhandler = 0 (internal default)

comsys-dm0: rr_weight = 1 (internal default)

comsys-dm0: minio = 1000 (config file default)

comsys-dm0: no_path_retry = NONE (internal default)

pg_timeout = NONE (internal default)

comsys-dm0: set ACT_NOTHING (map unchanged)

sdc: ownership set to comsys-dm1

sdc: not found in pathvec

sdc: mask = 0xc

sdc: state = 2

sdc: prio = 1

sdf: ownership set to comsys-dm1

sdf: not found in pathvec

sdf: mask = 0xc

sdf: state = 2

sdf: prio = 1

sdi: ownership set to comsys-dm1

sdi: not found in pathvec

sdi: mask = 0xc

sdi: state = 2

sdi: prio = 1

sdl: ownership set to comsys-dm1

sdl: not found in pathvec

sdl: mask = 0xc

sdl: state = 2

sdl: prio = 1

comsys-dm1: pgfailover = -1 (internal default)

comsys-dm1: pgpolicy = multibus (LUN setting)

comsys-dm1: selector = round-robin 0 (LUN setting)

comsys-dm1: features = 0 (internal default)

comsys-dm1: hwhandler = 0 (internal default)

comsys-dm1: rr_weight = 1 (internal default)

comsys-dm1: minio = 1000 (config file default)

comsys-dm1: no_path_retry = NONE (internal default)

pg_timeout = NONE (internal default)

comsys-dm1: set ACT_NOTHING (map unchanged)

sdd: ownership set to comsys-backup

sdd: not found in pathvec

sdd: mask = 0xc

sdd: state = 2

sdd: prio = 1

sdg: ownership set to comsys-backup

sdg: not found in pathvec

sdg: mask = 0xc

sdg: state = 2

sdg: prio = 1

sdj: ownership set to comsys-backup

sdj: not found in pathvec

sdj: mask = 0xc

sdj: state = 2

sdj: prio = 1

sdm: ownership set to comsys-backup

sdm: not found in pathvec

sdm: mask = 0xc

sdm: state = 2

sdm: prio = 1

comsys-backup: pgfailover = -1 (internal default)

comsys-backup: pgpolicy = multibus (LUN setting)

comsys-backup: selector = round-robin 0 (LUN setting)

comsys-backup: features = 0 (internal default)

comsys-backup: hwhandler = 0 (internal default)

comsys-backup: rr_weight = 1 (internal default)

comsys-backup: minio = 1000 (config file default)

comsys-backup: no_path_retry = NONE (internal default)

pg_timeout = NONE (internal default)

comsys-backup: set ACT_NOTHING (map unchanged)

下面是相關參數的標準文檔的介紹:

Attribute

Description

wwid

Specifies the WWID of the multipath  device to which themultipath attributes apply. This parameter is  mandatory for this section of themultipath.conf file.

alias

Specifies the symbolic name for the  multipath device to which themultipath attributes apply. If you  are usinguser_friendly_names, do not set this value tompathn;  this may conflict with an automatically assigned user friendly name and give  you incorrect device node names.

path_grouping_policy

Specifies the    default path grouping policy to apply to unspecified multipaths. Possible    values include: failover = 1 path per priority group multibus = all valid paths in 1 priority group group_by_serial = 1 priority group per detected serial    number group_by_prio = 1 priority group per path priority value group_by_node_name = 1 priority group per target node name

 

path_selector

Specifies the    default algorithm to use in determining what path to use for the next I/O    operation. Possible values include: round-robin 0: Loop through every path in the path group,    sending the same amount of I/O to each. queue-length 0: Send the next bunch of I/O down the path with    the least number of outstanding I/O requests. service-time 0: Send the next bunch of I/O down the path with    the shortest estimated service time, which is determined by dividing the    total size of the outstanding I/O to each path by its relative throughput.

 

failback

Manages path    group failback. A value    of immediate specifies immediate failback to the highest    priority path group that contains active paths. A value    of manual specifies that there should not be immediate    failback but that failback can happen only with operator intervention. A value    of followover specifies that automatic failback should be    performed when the first path of a path group becomes active. This keeps a    node from automatically failing back when another node requested the    failover. A numeric    value greater than zero specifies deferred failback, expressed in seconds.

 

prio

Specifies the    default function to call to obtain a path priority value. For example, the    ALUA bits in SPC-3 provide an exploitableprio value. Possible    values include: const: Set a priority of 1 to all paths. emc: Generate the path priority for EMC arrays. alua: Generate the path priority based on the SCSI-3    ALUA settings. tpg_pref: Generate the path priority based on the SCSI-3    ALUA settings, using the preferred port bit. ontap: Generate the path priority for NetApp arrays. rdac: Generate the path priority for LSI/Engenio RDAC    controller. hp_sw: Generate the path priority for Compaq/HP    controller in active/standby mode. hds: Generate the path priority for Hitachi HDS    Modular storage arrays.

 

no_path_retry

A numeric    value for this attribute specifies the number of times the system should    attempt to use a failed path before disabling queueing. A value    of fail indicates immediate failure, without queueing. A value    of queue indicates that queueing should not stop until the    path is fixed.

 

rr_min_io

Specifies the number of I/O requests  to route to a path before switching to the next path in the current path  group. This setting is only for systems running kernels older that 2.6.31.  Newer systems should userr_min_io_rq. The default value is 1000.

rr_min_io_rq

Specifies the number of I/O requests  to route to a path before switching to the next path in the current path group,  using request-based device-mapper-multipath. This setting should be used on  systems running current kernels. On systems running kernels older than  2.6.31, use rr_min_io. The default value is 1.

rr_weight

If set to priorities, then  instead of sending rr_min_iorequests to a path before  calling path_selector to choose the next path, the number of  requests to send is determined byrr_min_io times the path's  priority, as determined by theprio function. If set to uniform,  all path weights are equal.

flush_on_last_del

If set to yes, then  multipath will disable queueing when the last path to a device has been  deleted.

3、啟動multipathd服務并設置其自動啟動

[root@seaing ~]#service multipathd restart

[root@seaing ~]#chkconfig --level 345 multipathd on

[root@seaing ~]#chkconfig --list | grep multipathd

4、檢查multipath聚合后的設備名,以及設備對應的鏈路情況

[root@seaing ~]# multipath -ll

comsys-dm1 (3600508b4000892b90002a00000090000) dm-3 HP,HSV300

[size=200G][features=0][hwhandler=0][rw]

\_ round-robin 0 [prio=4][active]

 \_ 4:0:0:2 sdc 8:32  [active][ready]

 \_ 4:0:1:2 sdf 8:80  [active][ready]

 \_ 5:0:0:2 sdi 8:128 [active][ready]

 \_ 5:0:1:2 sdl 8:176 [active][ready]

comsys-dm0 (3600508b4000892b90002a00000050000) dm-2 HP,HSV300

[size=100G][features=0][hwhandler=0][rw]

\_ round-robin 0 [prio=4][active]

 \_ 4:0:0:1 sdb 8:16  [active][ready]

 \_ 4:0:1:1 sde 8:64  [active][ready]

 \_ 5:0:0:1 sdh 8:112 [active][ready]

 \_ 5:0:1:1 sdk 8:160 [active][ready]

comsys-backup (3600508b4000892b90002a00000140000) dm-4 HP,HSV300

[size=100G][features=0][hwhandler=0][rw]

\_ round-robin 0 [prio=4][active]

 \_ 4:0:0:3 sdd 8:48  [active][ready]

 \_ 4:0:1:3 sdg 8:96  [active][ready]

 \_ 5:0:0:3 sdj 8:144 [active][ready]

 \_ 5:0:1:3 sdm 8:192 [active][ready]

5、檢查配置是否成功

如果配置正確的話就會在/dev/mapper/目錄下多出mpath0、mpath2(自動分配的名稱)等之類設備,但是因為作者在配置的時候,起了別名,所以會使用別名來代替自動分配的名稱

[root@seaing ~]# ll /dev/mapper/

total 0

brw-rw---- 1 root disk 253,  4 Oct 26 14:30 comsys-backup

brw-rw---- 1 root disk 253,  2 Oct 26 14:30 comsys-dm0

brw-rw---- 1 root disk 253,  3 Oct 26 14:30 comsys-dm1

crw------- 1 root root  10, 63 Oct 26 14:30 control

brw-rw---- 1 root disk 253,  0 Oct 26 14:30 VolGroup00-LogVol00

brw-rw---- 1 root disk 253,  1 Oct 26 14:30 VolGroup00-LogVol01

用fdisk -l命令可以看到多路徑軟件創建的磁盤,如下圖中的/dev/dm-[0-3]

[root@seaing ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes

255 heads, 63 sectors/track, 60801 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       60801   488279610   8e  Linux LVM

Disk /dev/sdb: 107.3 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 214.7 GB, 214748364800 bytes

255 heads, 63 sectors/track, 26108 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table

Disk /dev/sdd: 107.3 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn't contain a valid partition table

Disk /dev/sde: 107.3 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sde doesn't contain a valid partition table

Disk /dev/sdf: 214.7 GB, 214748364800 bytes

255 heads, 63 sectors/track, 26108 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdf doesn't contain a valid partition table

Disk /dev/sdg: 107.3 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdg doesn't contain a valid partition table

Disk /dev/sdh: 107.3 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdh doesn't contain a valid partition table

Disk /dev/sdi: 214.7 GB, 214748364800 bytes

255 heads, 63 sectors/track, 26108 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdi doesn't contain a valid partition table

Disk /dev/sdj: 107.3 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdj doesn't contain a valid partition table

Disk /dev/sdk: 107.3 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdk doesn't contain a valid partition table

Disk /dev/sdl: 214.7 GB, 214748364800 bytes

255 heads, 63 sectors/track, 26108 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdl doesn't contain a valid partition table

Disk /dev/sdm: 107.3 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdm doesn't contain a valid partition table

Disk /dev/dm-2: 107.3 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/dm-2 doesn't contain a valid partition table

 

Disk /dev/dm-3: 214.7 GB, 214748364800 bytes

255 heads, 63 sectors/track, 26108 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/dm-3 doesn't contain a valid partition table

 

Disk /dev/dm-4: 107.3 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/dm-4 doesn't contain a valid partition table

[root@seaing ~]# ll /dev/mpath/

total 0

lrwxrwxrwx 1 root root 7 Oct 26 14:30 comsys-backup -> ../dm-4

lrwxrwxrwx 1 root root 7 Oct 26 14:30 comsys-dm0 -> ../dm-2

lrwxrwxrwx 1 root root 7 Oct 26 14:30 comsys-dm1 -> ../dm-3

multipath基本操作命令 
[root@seaing ~]#/etc/init.d/multipathd start #開啟mulitipath服務 
[root@seaing ~]#multipath -F                   #刪除現有路徑 
[root@seaing ~]#multipath -v2                  #格式化路徑 
[root@seaing ~]#multipath -ll                  #查看多路徑

三、multipath的使用案例

要對多路徑軟件生成的磁盤進行操作直接操作/dev/mapper/目錄下的磁盤就行。在對多路徑軟件生成的磁盤進行分區之前最好運行一下pvcreate命令:

[root@seaing ~]# pvcreate /dev/mapper/comsys-dm0
  Physical volume "/dev/mapper/comsys-dm0" successfully created
[root@seaing ~]#
[root@seaing ~]# pvs
  PV         VG         Fmt  Attr PSize   PFree
  /dev/dm-2             lvm2 --   100.00G 100.00G
  /dev/sda2  VolGroup00 lvm2 a-   465.66G      0
[root@seaing ~]# fdisk /dev/mapper/comsys-dm0
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
 
 
The number of cylinders for this disk is set to 13054.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-13054, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-13054, default 13054): +10G
 
Command (m for help): p
 
Disk /dev/mapper/comsys-dm0: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
                  Device Boot      Start         End      Blocks   Id  System
/dev/mapper/comsys-dm0p1               1        1217     9775521   83  Linux
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1218-13054, default 1218):
Using default value 1218
Last cylinder or +size or +sizeM or +sizeK (1218-13054, default 13054): +20G
 
Command (m for help): p
 
Disk /dev/mapper/comsys-dm0: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
                  Device Boot      Start         End      Blocks   Id  System
/dev/mapper/comsys-dm0p1               1        1217     9775521   83  Linux
/dev/mapper/comsys-dm0p2            1218        3650    19543072+  83  Linux
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
 
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
 

用fdisk對多路徑軟件生成的磁盤進行分區保存時會有一個報錯,此報錯不用理會。

 
 
 
[root@seaing ~]# fdisk -l
 
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 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       60801   488279610   8e  Linux LVM
 
Disk /dev/sdb: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
 
Disk /dev/sdc: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdc doesn't contain a valid partition table
 
Disk /dev/sdd: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdd doesn't contain a valid partition table
 
Disk /dev/sde: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
 
Disk /dev/sdf: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdf doesn't contain a valid partition table
 
Disk /dev/sdg: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdg doesn't contain a valid partition table
 
Disk /dev/sdh: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
 
Disk /dev/sdi: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdi doesn't contain a valid partition table
 
Disk /dev/sdj: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdj doesn't contain a valid partition table
 
Disk /dev/sdk: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
 
Disk /dev/sdl: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdl doesn't contain a valid partition table
 
Disk /dev/sdm: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdm doesn't contain a valid partition table
 
Disk /dev/dm-2: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
     Device Boot      Start         End      Blocks   Id  System
/dev/dm-2p1               1        1217     9775521   83  Linux
/dev/dm-2p2            1218        3650    19543072+  83  Linux
 
Disk /dev/dm-3: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/dm-3 doesn't contain a valid partition table
 
Disk /dev/dm-4: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/dm-4 doesn't contain a valid partition table
 
 

fdisk對多路徑軟件生成的磁盤進行分區之后,所生成的磁盤分區并沒有馬上添加到/dev/目錄下,此時我們要重啟IPSAN或者FCSAN的驅動,如果是用iscsi-initiator來連接IPSAN的重啟ISCSI服務就可以發現所生成的磁盤分區了;如果是FCSAN的話,需要重新啟動操作系統才能識別到。

 
[root@seaing ~]# ll /dev/dm*
brw-rw---- 1 root root 253, 2 Oct 26 14:20 /dev/dm-2
brw-rw---- 1 root root 253, 3 Oct 26 14:15 /dev/dm-3
brw-rw---- 1 root root 253, 4 Oct 26 14:15 /dev/dm-4
[root@seaing ~]#
[root@seaing ~]# ll /dev/mapper/
total 0
brw-rw---- 1 root disk 253,  4 Oct 26 14:15 comsys-backup
brw-rw---- 1 root disk 253,  2 Oct 26 14:22 comsys-dm0
brw-rw---- 1 root disk 253,  3 Oct 26 14:15 comsys-dm1
crw------- 1 root root  10, 63 Oct 26 14:15 control
brw-rw---- 1 root disk 253,  0 Oct 26 14:15 VolGroup00-LogVol00
brw-rw---- 1 root disk 253,  1 Oct 26 14:15 VolGroup00-LogVol01
重啟操作系統之后
 
如下的comsys-dm0p1和comsys-dm0p2就是我們對multipath磁盤進行的分區
[root@seaing ~]# ll /dev/mapper/
total 0
brw-rw---- 1 root disk 253,  4 Oct 26 14:30 comsys-backup
brw-rw---- 1 root disk 253,  2 Oct 26 14:30 comsys-dm0
brw-rw---- 1 root disk 253,  5 Oct 26 14:35 comsys-dm0p1
brw-rw---- 1 root disk 253,  6 Oct 26 14:30 comsys-dm0p2
brw-rw---- 1 root disk 253,  3 Oct 26 14:30 comsys-dm1
crw------- 1 root root  10, 63 Oct 26 14:30 control
 
[root@seaing ~]# ll /dev/dm*
brw-rw---- 1 root root 253, 2 Oct 26 14:30 /dev/dm-2
brw-rw---- 1 root root 253, 3 Oct 26 14:30 /dev/dm-3
brw-rw---- 1 root root 253, 4 Oct 26 14:30 /dev/dm-4
brw-rw---- 1 root root 253, 5 Oct 26 14:30 /dev/dm-5
brw-rw---- 1 root root 253, 6 Oct 26 14:30 /dev/dm-6
 
[root@seaing ~]# ll /dev/mpath/
total 0
lrwxrwxrwx 1 root root 7 Oct 26 14:30 comsys-backup -> ../dm-4
lrwxrwxrwx 1 root root 7 Oct 26 14:30 comsys-dm0 -> ../dm-2
lrwxrwxrwx 1 root root 7 Oct 26 14:30 comsys-dm0p1 -> ../dm-5
lrwxrwxrwx 1 root root 7 Oct 26 14:30 comsys-dm0p2 -> ../dm-6
lrwxrwxrwx 1 root root 7 Oct 26 14:30 comsys-dm1 -> ../dm-3
 
[root@seaing ~]# fdisk -l
 
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 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       60801   488279610   8e  Linux LVM
 
Disk /dev/sdb: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1217     9775521   83  Linux
/dev/sdb2            1218        3650    19543072+  83  Linux
 
Disk /dev/sdc: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdc doesn't contain a valid partition table
 
Disk /dev/sdd: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdd doesn't contain a valid partition table
 
Disk /dev/sde: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1        1217     9775521   83  Linux
/dev/sde2            1218        3650    19543072+  83  Linux
 
Disk /dev/sdf: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdf doesn't contain a valid partition table
 
Disk /dev/sdg: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdg doesn't contain a valid partition table
 
Disk /dev/sdh: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdh2               1        1217     9775521   83  Linux
/dev/sdh3            1218        3650    19543072+  83  Linux
 
Disk /dev/sdi: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdi doesn't contain a valid partition table
 
Disk /dev/sdj: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdj doesn't contain a valid partition table
 
Disk /dev/sdk: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdk1               1        1217     9775521   83  Linux
/dev/sdk2            1218        3650    19543072+  83  Linux
 
Disk /dev/sdl: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdl doesn't contain a valid partition table
 
Disk /dev/sdm: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdm doesn't contain a valid partition table
 
Disk /dev/dm-2: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
     Device Boot      Start         End      Blocks   Id  System
/dev/dm-2p1               1        1217     9775521   83  Linux
/dev/dm-2p2            1218        3650    19543072+  83  Linux
 
Disk /dev/dm-3: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/dm-3 doesn't contain a valid partition table
 
Disk /dev/dm-4: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/dm-4 doesn't contain a valid partition table
 
Disk /dev/dm-5: 10.0 GB, 10010133504 bytes
255 heads, 63 sectors/track, 1216 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/dm-5 doesn't contain a valid partition table
 
Disk /dev/dm-6: 20.0 GB, 20012106240 bytes
255 heads, 63 sectors/track, 2433 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/dm-6 doesn't contain a valid partition table

對comsys-dm0p1分區格式化成ext3文件系統

 
[root@seaing ~]# mkfs.ext3 /dev/mapper/comsys-dm0p1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1224000 inodes, 2443880 blocks
122194 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2503999488
75 block groups
32768 blocks per group, 32768 fragments per group
16320 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
 
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@seaing ~]#
[root@seaing ~]#
[root@seaing ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      434G  8.4G  404G   3% /
/dev/sda1              99M   18M   77M  19% /boot
tmpfs                 7.9G     0  7.9G   0% /dev/shm
/software/rhel5.5-x86_64.iso
                      3.5G  3.5G     0 100% /mnt/dvd
 
 
將/dev/mapper/comsys-dm0p1掛載到/comsys目錄下
 [root@seaing ~]# mount /dev/mapper/comsys-dm0p1 /comsys/
[root@seaing ~]#
[root@seaing ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      434G  8.4G  404G   3% /
/dev/sda1              99M   18M   77M  19% /boot
tmpfs                 7.9G     0  7.9G   0% /dev/shm
/software/rhel5.5-x86_64.iso
                      3.5G  3.5G     0 100% /mnt/dvd
/dev/mapper/comsys-dm0p1
                      9.2G  150M  8.6G   2% /comsys

當然,也可以將磁盤創建成物理卷,然后在物理卷基礎上創建卷組,然后創建邏輯卷,最后在格式化成文件系統進行掛載,下面的案例就是通過這種方法實現的(注意:下面的案例與上面的案例并沒有聯系,讀者朋友請注意!)

[root@seaing ~]# ll /dev/mapper/
total 0
brw-rw---- 1 root disk 253,  4 Oct 25 11:14 comsys-backup
brw-rw---- 1 root disk 253,  2 Oct 25 11:14 comsys-dm0
brw-rw---- 1 root disk 253,  5 Oct 25 11:14 comsys-dm0p1
brw-rw---- 1 root disk 253,  6 Oct 25 11:14 comsys-dm0p2
brw-rw---- 1 root disk 253,  7 Oct 25 11:14 comsys-dm0p3
brw-rw---- 1 root disk 253,  3 Oct 25 11:14 comsys-dm1
crw------- 1 root root  10, 63 Oct 25 11:14 control
brw-rw---- 1 root disk 253,  0 Oct 25 11:14 VolGroup00-LogVol00
brw-rw---- 1 root disk 253,  1 Oct 25 11:14 VolGroup00-LogVol01
[root@seaing ~]#
[root@seaing ~]#
[root@seaing ~]# mkdir /backup
[root@seaing ~]#
[root@seaing ~]# mount /dev/mapper/comsys-backup /backup
mount: you must specify the filesystem type
[root@seaing ~]# pvs
  PV         VG         Fmt  Attr PSize   PFree
  /dev/sda2  VolGroup00 lvm2 a-   465.66G    0
[root@seaing ~]#
[root@seaing ~]# vgs
  VG         #PV #LV #SN Attr   VSize   VFree
  VolGroup00   1   2   0 wz--n- 465.66G    0
[root@seaing ~]#
[root@seaing ~]# lvs
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  LogVol00 VolGroup00 -wi-ao 448.03G
  LogVol01 VolGroup00 -wi-ao  17.62G
[root@seaing ~]#
[root@seaing ~]# pvcreate /dev/mapper/comsys-backup
  Physical volume "/dev/mapper/comsys-backup" successfully created
[root@seaing ~]#
[root@seaing ~]# pvs
  PV         VG         Fmt  Attr PSize   PFree
  /dev/dm-4             lvm2 --   100.00G 100.00G
  /dev/sda2  VolGroup00 lvm2 a-   465.66G      0
[root@seaing ~]#
[root@seaing ~]# vgcreate vg_backup /dev/mapper/comsys-backup
  Volume group "vg_backup" successfully created
[root@seaing ~]#
[root@seaing ~]#
[root@seaing ~]# vgs
  VG         #PV #LV #SN Attr   VSize   VFree
  VolGroup00   1   2   0 wz--n- 465.66G      0
  vg_backup    1   0   0 wz--n- 100.00G 100.00G
[root@seaing ~]#
[root@seaing ~]# pvs
  PV         VG         Fmt  Attr PSize   PFree
  /dev/dm-4  vg_backup  lvm2 a-   100.00G 100.00G
  /dev/sda2  VolGroup00 lvm2 a-   465.66G      0
[root@seaing ~]#
[root@seaing ~]#
[root@seaing ~]# lvcreate -L 20G -n lv_backup vg_backup
  Logical volume "lv_backup" created
[root@seaing ~]#
[root@seaing ~]# lvs
  LV        VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  LogVol00  VolGroup00 -wi-ao 448.03G
  LogVol01  VolGroup00 -wi-ao  17.62G
  lv_backup vg_backup  -wi-a-  20.00G
[root@seaing ~]#
[root@seaing ~]#
[root@seaing ~]# mkfs.ext3 /dev/vg_backup/lv_backup
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2621440 inodes, 5242880 blocks
262144 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
160 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000
 
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@seaing ~]#
[root@seaing ~]#
[root@seaing ~]# mount /dev/vg_backup/lv_backup /backup
 
[root@seaing ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      434G  4.9G  407G   2% /
/dev/sda1              99M   18M   77M  19% /boot
tmpfs                 7.9G     0  7.9G   0% /dev/shm
/dev/mapper/vg_backup-lv_backup
                       20G  173M   19G   1% /backup

以上就是Linux Multipath多路徑配置以及使用分析,小編相信有部分知識點可能是我們日常工作會見到或用到的。希望你能通過這篇文章學到更多知識。更多詳情敬請關注億速云行業資訊頻道。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

探索| 涞水县| 封开县| 攀枝花市| 贺州市| 嵊泗县| 额敏县| 罗山县| 长顺县| 通化县| 宜丰县| 都匀市| 乌兰察布市| 扬中市| 金溪县| 南昌县| 巨野县| 建阳市| 临海市| 凤城市| 沁源县| 永寿县| 元氏县| 南安市| 兴化市| 尤溪县| 皮山县| 定西市| 井冈山市| 布尔津县| 鄂州市| 灵山县| 宁夏| 龙门县| 新巴尔虎右旗| 九台市| 陆川县| 大宁县| 华亭县| 磐石市| 临泽县|