Linux平臺的多路徑軟體multipath的使用案例

達芬奇的夢發表於2018-05-14

        在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--

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31444259/viewspace-2154430/,如需轉載,請註明出處,否則將追究法律責任。

相關文章