Linux平台的多路徑軟件multipath的使用案例


本文源自:http://blog.itpub.net/23135684/viewspace-745789/

在Linux和AIX平台都有一部分存儲產品使用操作系統自帶的多路徑軟件,包括最常見的HP和IBM的部分存儲產品,在Linux自帶的多路徑軟件叫做multipath,這篇文章以IBM N系列存儲在Linux平台的使用為例,討論Linux平台multipath的使用。

1.確保安裝以下的包:

device-mapper             

device-mapper-multipath   

 

2.編輯配置文件/etc/multipath.conf

[root@rac01 ~]# vi /etc/multipath.conf

 

defaults

{

       user_friendly_names       yes

       max_fds                   max

       queue_without_daemon      no

       flush_on_last_del         yes

}

 

## Blacklist non-SAN devices

#sample:

#devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"

#devnode "^hd[a-z]"

#devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]"

 

blacklist

{

       wwid    3600605b002b6b890163d47661e8d4fbe

}

 

# FCP configuration, for a NetApp FAS3xxx / IBM Nxx00

# Vendor is "NETAPP  ", spaces are important

# Product is "LUN", though "*" will do

 

devices

{

       device

       {

              vendor                     "NETAPP"

              product                    "LUN"

              getuid_callout             "/sbin/scsi_id -g -u -s /block/%n"

              prio_callout               "/sbin/mpath_prio_ontap /dev/%n"

              features                   "1 queue_if_no_path"

              hardware_handler           "0"

              path_grouping_policy       group_by_prio

              failback                   immediate

              rr_weight                  uniform

              rr_min_io                  128

              path_checker               directio

              }

}

#下面的注釋配置不是必須的,配置之后可以固定系統設備的名稱,這在服務器重啟設備文件對應的磁盤設備發生變化的情況下使用。

#multipaths 

#{

#              multipath {

#                                 wwid 360a9800065344e6f465a6d5773745558

#                                 alias mocr1

#                              }

#              multipath {

#                                 wwid 360a9800065344e6e536f6d586d306630

#                                 alias mocr2

#                              }

#}

 

 

3.啟動multipathd服務,及設置其自動啟動。

執行以下的命令:

#service multipathd restart

#chkconfig --level 345 multipathd on

#chkconfig --list | grep multipathd

 

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

[root@rac2 ~]# multipath -ll

mpath2 (360a9800065344e6f465a6d5773747545) dm-3 NETAPP,LUN

size=2.0G features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  |- 1:0:0:5  sdf 8:80  active ready  running

  `- 2:0:0:5  sdp 8:240 active ready  running

mpath1 (360a9800065344e6f465a6d5773746878) dm-1 NETAPP,LUN

size=2.0G features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  |- 1:0:0:3  sdd 8:48  active ready  running

  `- 2:0:0:3  sdn 8:208 active ready  running

mpath0 (360a9800065344e6f465a6d5773745558) dm-0 NETAPP,LUN

size=2.0G features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  |- 1:0:0:1  sdb 8:16  active ready  running

  `- 2:0:0:1  sdl 8:176 active ready  running

mpath9 (360a9800065344e6e536f6d586d33666e) dm-9 NETAPP,LUN

size=3.9T features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  |- 1:0:0:10 sdk 8:160 active ready  running

  `- 2:0:0:10 sdu 65:64 active ready  running

mpath8 (360a9800065344e6e536f6d586d32766b) dm-7 NETAPP,LUN

size=150G features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  |- 1:0:0:8  sdi 8:128 active ready  running

  `- 2:0:0:8  sds 65:32 active ready  running

mpath7 (360a9800065344e6e536f6d586d313851) dm-6 NETAPP,LUN

size=2.0G features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  |- 1:0:0:6  sdg 8:96  active ready  running

  `- 2:0:0:6  sdq 65:0  active ready  running

mpath6 (360a9800065344e6e536f6d586d307464) dm-4 NETAPP,LUN

size=2.0G features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  |- 1:0:0:4  sde 8:64  active ready  running

  `- 2:0:0:4  sdo 8:224 active ready  running

mpath5 (360a9800065344e6e536f6d586d306630) dm-2 NETAPP,LUN

size=2.0G features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  |- 1:0:0:2  sdc 8:32  active ready  running

  `- 2:0:0:2  sdm 8:192 active ready  running

mpath4 (360a9800065344e6f465a6d577376304f) dm-8 NETAPP,LUN

size=3.9T features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  |- 1:0:0:9  sdj 8:144 active ready  running

  `- 2:0:0:9  sdt 65:48 active ready  running

mpath3 (360a9800065344e6f465a6d5773766c58) dm-5 NETAPP,LUN

size=150G features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  |- 1:0:0:7  sdh 8:112 active ready  running

  `- 2:0:0:7  sdr 65:16 active ready  running


        從以上的結果可以看出,每個磁盤設備對應的是兩條鏈路,根據不存的存儲以及不同的配置會有所不同。每個設備都有兩個multipath設備名,分別是mpath[x]和dm-[x],mpath位於/dev/mpath目錄下,dm-[x]位於/dev目錄下。通常推薦使用/dev/mpath目錄下的設備名,這對於我們來說更加的方便。

 

5.下面我們重點關注一下fdisk -l執行的結果。

[root@rac2 ~]# fdisk -l

 

Disk /dev/sda: 145.9 GB, 145999527936 bytes

255 heads, 63 sectors/track, 17750 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          64      514048+  83  Linux

/dev/sda2              65        6438    51199155   83  Linux

/dev/sda3            6439        7743    10482412+  82  Linux swap / Solaris

/dev/sda4            7744       17750    80381227+   5  Extended

/dev/sda5            7744       17750    80381196   83  Linux

 

Disk /dev/sdb: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1         261     2096451   83  Linux

 

Disk /dev/sdd: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdd1               1         261     2096451   83  Linux

 

Disk /dev/sdf: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdf1               1         261     2096451   83  Linux

 

Disk /dev/sdc: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1               1         261     2096451   83  Linux

 

Disk /dev/sde: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sde1               1         261     2096451   83  Linux

 

Disk /dev/sdh: 161.0 GB, 161061273600 bytes

255 heads, 63 sectors/track, 19581 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdh1               1       19581   157284351   83  Linux

 

Disk /dev/sdg: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdg1               1         261     2096451   83  Linux

 

Disk /dev/sdi: 161.0 GB, 161061273600 bytes

255 heads, 63 sectors/track, 19581 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdi1               1       19581   157284351   83  Linux

 

WARNING: GPT (GUID Partition Table) detected on '/dev/sdj'! The util fdisk doesn't support GPT. Use GNU Parted.

 

 

WARNING: The size of this disk is 4.2 TB (4241280204800 bytes).

DOS partition table format can not be used on drives for volumes

larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID 

partition table format (GPT).

 

 

Disk /dev/sdj: 4241.2 GB, 4241280204800 bytes

255 heads, 63 sectors/track, 515639 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdj1               1      267350  2147483647+  ee  EFI GPT

 

WARNING: GPT (GUID Partition Table) detected on '/dev/sdk'! The util fdisk doesn't support GPT. Use GNU Parted.

 

 

WARNING: The size of this disk is 4.2 TB (4241280204800 bytes).

DOS partition table format can not be used on drives for volumes

larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID 

partition table format (GPT).

 

 

Disk /dev/sdk: 4241.2 GB, 4241280204800 bytes

255 heads, 63 sectors/track, 515639 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdk1               1      267350  2147483647+  ee  EFI GPT

 

Disk /dev/sdl: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdl1               1         261     2096451   83  Linux

 

Disk /dev/sdm: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdm1               1         261     2096451   83  Linux

 

Disk /dev/sdn: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdn1               1         261     2096451   83  Linux

 

Disk /dev/sdp: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdp1               1         261     2096451   83  Linux

 

Disk /dev/sdo: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdo1               1         261     2096451   83  Linux

 

Disk /dev/sdr: 161.0 GB, 161061273600 bytes

255 heads, 63 sectors/track, 19581 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdr1               1       19581   157284351   83  Linux

 

Disk /dev/sdq: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdq1               1         261     2096451   83  Linux

 

Disk /dev/sds: 161.0 GB, 161061273600 bytes

255 heads, 63 sectors/track, 19581 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sds1               1       19581   157284351   83  Linux

 

WARNING: GPT (GUID Partition Table) detected on '/dev/sdt'! The util fdisk doesn't support GPT. Use GNU Parted.

 

 

WARNING: The size of this disk is 4.2 TB (4241280204800 bytes).

DOS partition table format can not be used on drives for volumes

larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID 

partition table format (GPT).

 

 

Disk /dev/sdt: 4241.2 GB, 4241280204800 bytes

255 heads, 63 sectors/track, 515639 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdt1               1      267350  2147483647+  ee  EFI GPT

 

WARNING: GPT (GUID Partition Table) detected on '/dev/sdu'! The util fdisk doesn't support GPT. Use GNU Parted.

 

 

WARNING: The size of this disk is 4.2 TB (4241280204800 bytes).

DOS partition table format can not be used on drives for volumes

larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID 

partition table format (GPT).

 

 

Disk /dev/sdu: 4241.2 GB, 4241280204800 bytes

255 heads, 63 sectors/track, 515639 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdu1               1      267350  2147483647+  ee  EFI GPT

 

        這之前的設備是/dev/sd[n]的設備名,這部分設備是沒有聚合的設備,根據上面顯示的兩條鏈路,那么相同的LUN應該對應兩個sd[n]設備,這部分不是使用的設備,可以不關注。

 

Disk /dev/dm-0: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-0p1               1         261     2096451   83  Linux

 

Disk /dev/dm-1: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-1p1               1         261     2096451   83  Linux

 

Disk /dev/dm-2: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-2p1               1         261     2096451   83  Linux

 

Disk /dev/dm-3: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-3p1               1         261     2096451   83  Linux

 

Disk /dev/dm-4: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-4p1               1         261     2096451   83  Linux

 

Disk /dev/dm-5: 161.0 GB, 161061273600 bytes

255 heads, 63 sectors/track, 19581 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-5p1               1       19581   157284351   83  Linux

 

Disk /dev/dm-6: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-6p1               1         261     2096451   83  Linux

 

Disk /dev/dm-7: 161.0 GB, 161061273600 bytes

255 heads, 63 sectors/track, 19581 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-7p1               1       19581   157284351   83  Linux

 

WARNING: GPT (GUID Partition Table) detected on '/dev/dm-8'! The util fdisk doesn't support GPT. Use GNU Parted.

 

 

WARNING: The size of this disk is 4.2 TB (4241280204800 bytes).

DOS partition table format can not be used on drives for volumes

larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID 

partition table format (GPT).

 

 

Disk /dev/dm-8: 4241.2 GB, 4241280204800 bytes

255 heads, 63 sectors/track, 515639 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-8p1               1      267350  2147483647+  ee  EFI GPT

 

WARNING: GPT (GUID Partition Table) detected on '/dev/dm-9'! The util fdisk doesn't support GPT. Use GNU Parted.

 

 

WARNING: The size of this disk is 4.2 TB (4241280204800 bytes).

DOS partition table format can not be used on drives for volumes

larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID 

partition table format (GPT).

 

 

Disk /dev/dm-9: 4241.2 GB, 4241280204800 bytes

255 heads, 63 sectors/track, 515639 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-9p1               1      267350  2147483647+  ee  EFI GPT

 

        這部分設備分別是/dev/dm-[n]以及它們的分區/dev/dm-[n]p1,這部分是安裝好multipath多路徑軟件及針對每個磁盤設備分區后產生的,但實際在/dev/目錄下不存在dm-[n]p1這部分設備文件,只需要了解即可。

 

Disk /dev/dm-10: 2146 MB, 2146765824 bytes

255 heads, 63 sectors/track, 260 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

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

 

Disk /dev/dm-11: 2146 MB, 2146765824 bytes

255 heads, 63 sectors/track, 260 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

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

 

Disk /dev/dm-12: 2146 MB, 2146765824 bytes

255 heads, 63 sectors/track, 260 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

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

 

Disk /dev/dm-13: 2146 MB, 2146765824 bytes

255 heads, 63 sectors/track, 260 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

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

 

Disk /dev/dm-14: 161.0 GB, 161059175424 bytes

255 heads, 63 sectors/track, 19580 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

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

 

Disk /dev/dm-15: 2146 MB, 2146765824 bytes

255 heads, 63 sectors/track, 260 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

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

 

Disk /dev/dm-16: 161.0 GB, 161059175424 bytes

255 heads, 63 sectors/track, 19580 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

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

 

Disk /dev/dm-17: 4241.2 GB, 4241280170496 bytes

255 heads, 63 sectors/track, 515639 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

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

 

Disk /dev/dm-18: 4241.2 GB, 4241280170496 bytes

255 heads, 63 sectors/track, 515639 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

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

 

Disk /dev/dm-19: 2146 MB, 2146765824 bytes

255 heads, 63 sectors/track, 260 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

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

 

        這部分設備名是/dev/dm-[n],這部分設備並不是multipath多路徑軟件聚合后的磁盤設備,而是做完分區的分區設備文件,再剛對前面的/dev/dm-0,dev/dm-1做完分區之后執行fdisk -l是看不到這部分設備信息的,只有重啟之后才看到這些設備信息並產生了相應的設備文件。例如,/dev/dm-10對應的是/dev/dm-0p1,/dev/dm-11對應的是/dev/dm-1p1,以此類推,這部分設備文件可以被使用,但由於這些設備文件對應multipath聚合的磁盤設備比較麻煩,所以並不推薦使用這種方式。

下面討論/dev/mpath目錄下的設備文件:

        安裝完multipath軟件並配置完成之后會在/dev/mpath目錄下生成聚合后的磁盤設備文件,實際是/dev/dm-[n]的鏈接文件:

  [root@rac2 mpath]# ls -al

total 0

drwxr-xr-x  2 root root  440 Sep 21 02:05 .

drwxr-xr-x 13 root root 7060 Sep 21 02:12 ..

lrwxrwxrwx  1 root root    7 Sep 21 02:05 mpath0 -> ../dm-0

lrwxrwxrwx  1 root root    8 Sep 21 02:05 mpath0p1 -> ../dm-19

lrwxrwxrwx  1 root root    7 Sep 21 02:05 mpath1 -> ../dm-1

lrwxrwxrwx  1 root root    8 Sep 21 02:05 mpath1p1 -> ../dm-10

lrwxrwxrwx  1 root root    7 Sep 21 02:05 mpath2 -> ../dm-2

lrwxrwxrwx  1 root root    8 Sep 21 02:05 mpath2p1 -> ../dm-17

lrwxrwxrwx  1 root root    7 Sep 21 02:05 mpath3 -> ../dm-5

lrwxrwxrwx  1 root root    8 Sep 21 02:05 mpath3p1 -> ../dm-12

lrwxrwxrwx  1 root root    7 Sep 21 02:05 mpath4 -> ../dm-7

lrwxrwxrwx  1 root root    8 Sep 21 02:05 mpath4p1 -> ../dm-14

lrwxrwxrwx  1 root root    7 Sep 21 02:05 mpath5 -> ../dm-3

lrwxrwxrwx  1 root root    8 Sep 21 02:05 mpath5p1 -> ../dm-18

lrwxrwxrwx  1 root root    7 Sep 21 02:05 mpath6 -> ../dm-4

lrwxrwxrwx  1 root root    8 Sep 21 02:05 mpath6p1 -> ../dm-11

lrwxrwxrwx  1 root root    7 Sep 21 02:05 mpath7 -> ../dm-6

lrwxrwxrwx  1 root root    8 Sep 21 02:05 mpath7p1 -> ../dm-13

lrwxrwxrwx  1 root root    7 Sep 21 02:05 mpath8 -> ../dm-9

lrwxrwxrwx  1 root root    8 Sep 21 02:05 mpath8p1 -> ../dm-16

lrwxrwxrwx  1 root root    7 Sep 21 02:05 mpath9 -> ../dm-8

lrwxrwxrwx  1 root root    8 Sep 21 02:05 mpath9p1 -> ../dm-15


        從上面的輸出結果我們可以非常容易的了解到磁盤分區設備文件與磁盤設備文件之間的對應關系,所以使用/dev/mpath目錄下的文件比使用/dev/目錄下磁盤設備和磁盤分區設備文件都以dm-[n]方式表示的文件更加方便。之后我們在使用oracleasm創建ASM磁盤的時候,使用fdisk -l /dev/mpath/mpath[n]p1查看磁盤信息,直接使用/dev/mpath/mpath[n]p1作為ASM磁盤,非常的方便。

 

還需要注意如下幾點:

1).經過multipath多路徑軟件聚合后的設備文件(/dev/mpath/mpath[n])不會隨着服務器的重啟,對應的磁盤設備發生變化,而/dev/sd[n]對應的磁盤LUN重啟后是可能發生變化的。


2).如果單個磁盤大於2TB,那么在分區的時候不要使用fdisk工具(傳統的MBR),應該使用parted(gpt),使用parted工具創建gpt分區的步驟是:

#parted

PARTED> select /dev/mpath/mpath0

PARTED> mklabel gpt

PARTED> mkpart primary 0 100%


3).如果我們使用ASM作為數據庫數據文件的存儲方式,那么單個ASM磁盤的大小不能超過2TB,所以在系統分區的時候就應該做好更小的分區,例如,/dev/mpath/mpath0磁盤的大小為3.8TB,那么在分區的時候應該做如下操作:

#parted

PARTED> select /dev/mpath/mpath0

PARTED> mklabel gpt

PARTED> mkpart primary 0 50%

PARTED> mkpart primary 50% 100%

        完成以上分區操作之后,重啟服務器,在/dev/mpath/目錄下就會看到mpath0p1和mpath0p2兩個設備文件,將這兩個設備文件作為ASM磁盤即可。

 

--end--


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM