Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

22.3. 利​​​​​​​用​​​​​​​ mdadm 設​​​​​​​定​​​​​​​ RAID 類​​​​​​​與​​​​​​​多​​​​​​​路​​​​​​​徑​​​​​​​(Multipath)的​​​​​​​儲​​​​​​​存​​​​​​​裝​​​​​​​置​​​​​​​

跟​​​​​​​ raidtools 套​​​​​​​件​​​​​​​組​​​​​​​中​​​​​​​的​​​​​​​工​​​​​​​具​​​​​​​一​​​​​​​樣​​​​​​​,mdadm 指​​​​​​​令​​​​​​​可​​​​​​​以​​​​​​​用​​​​​​​來​​​​​​​執​​​​​​​行​​​​​​​所​​​​​​​有​​​​​​​與​​​​​​​管​​​​​​​理​​​​​​​多​​​​​​​裝​​​​​​​置​​​​​​​組​​​​​​​相​​​​​​​關​​​​​​​的​​​​​​​功​​​​​​​能​​​​​​​。​​​​​​​在​​​​​​​本​​​​​​​節​​​​​​​中​​​​​​​,我​​​​​​​們​​​​​​​將​​​​​​​告​​​​​​​訴​​​​​​​您​​​​​​​如​​​​​​​何​​​​​​​利​​​​​​​用​​​​​​​ mdadm 指​​​​​​​令​​​​​​​,以​​​​​​​:
  • 建​​​​​​​立​​​​​​​ RAID 裝​​​​​​​置​​​​​​​
  • 建​​​​​​​立​​​​​​​多​​​​​​​路​​​​​​​徑​​​​​​​(multipath)裝​​​​​​​置​​​​​​​

22.3.1. 使​​​​​​​用​​​​​​​ mdadm 指​​​​​​​令​​​​​​​建​​​​​​​立​​​​​​​ RAID 裝​​​​​​​置​​​​​​​

要​​​​​​​建​​​​​​​立​​​​​​​ RAID 裝​​​​​​​置​​​​​​​,請​​​​​​​編​​​​​​​輯​​​​​​​ /etc/mdadm.conf 檔​​​​​​​案​​​​​​​,設​​​​​​​定​​​​​​​適​​​​​​​切​​​​​​​的​​​​​​​ DEVICE 與​​​​​​​ ARRAY 值​​​​​​​。​​​​​​​
DEVICE /dev/sd[abcd]1
ARRAY /dev/md0 devices=/dev/sda1,/dev/sdb1,/dev/sdc1,/dev/sdd1
在​​​​​​​本​​​​​​​例​​​​​​​中​​​​​​​,DEVICE 一​​​​​​​行​​​​​​​使​​​​​​​用​​​​​​​的​​​​​​​是​​​​​​​傳​​​​​​​統​​​​​​​檔​​​​​​​名​​​​​​​的​​​​​​​ glob 指​​​​​​​令​​​​​​​(請​​​​​​​參​​​​​​​照​​​​​​​ glob(7) man page 獲​​​​​​​得​​​​​​​更​​​​​​​多​​​​​​​訊​​​​​​​息​​​​​​​),以​​​​​​​定​​​​​​​義​​​​​​​以​​​​​​​下​​​​​​​的​​​​​​​ SCSI 裝​​​​​​​置​​​​​​​:
  • /dev/sda1
  • /dev/sdb1
  • /dev/sdc1
  • /dev/sdd1
而​​​​​​​ ARRAY 一​​​​​​​行​​​​​​​則​​​​​​​定​​​​​​​義​​​​​​​了​​​​​​​ DEVICE 行​​​​​​​中​​​​​​​,組​​​​​​​成​​​​​​​ RAID 的​​​​​​​裝​​​​​​​置​​​​​​​(/dev/md0)。​​​​​​​
在​​​​​​​建​​​​​​​立​​​​​​​或​​​​​​​使​​​​​​​用​​​​​​​任​​​​​​​何​​​​​​​ RAID 裝​​​​​​​置​​​​​​​前​​​​​​​,/proc/mdstat 檔​​​​​​​案​​​​​​​顯​​​​​​​示​​​​​​​目​​​​​​​前​​​​​​​系​​​​​​​統​​​​​​​並​​​​​​​無​​​​​​​任​​​​​​​何​​​​​​​ RAID 裝​​​​​​​置​​​​​​​運​​​​​​​作​​​​​​​中​​​​​​​:
Personalities :
read_ahead not set
Event: 0
unused devices: none
接​​​​​​​下​​​​​​​來​​​​​​​,使​​​​​​​用​​​​​​​以​​​​​​​上​​​​​​​設​​​​​​​定​​​​​​​與​​​​​​​ mdadm 指​​​​​​​令​​​​​​​,以​​​​​​​建​​​​​​​立​​​​​​​ RAID 0 陣​​​​​​​列​​​​​​​:
mdadm -C /dev/md0 --level=raid0 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 \
/dev/sdd1
Continue creating array? yes
mdadm: array /dev/md0 started.
建​​​​​​​立​​​​​​​完​​​​​​​成​​​​​​​之​​​​​​​後​​​​​​​,您​​​​​​​就​​​​​​​可​​​​​​​以​​​​​​​隨​​​​​​​時​​​​​​​查​​​​​​​詢​​​​​​​該​​​​​​​ RAID 裝​​​​​​​置​​​​​​​,獲​​​​​​​得​​​​​​​狀​​​​​​​態​​​​​​​資​​​​​​​訊​​​​​​​。​​​​​​​底​​​​​​​下​​​​​​​的​​​​​​​範​​​​​​​例​​​​​​​顯​​​​​​​示​​​​​​​了​​​​​​​使​​​​​​​用​​​​​​​ mdadm --detail /dev/md0 指​​​​​​​令​​​​​​​的​​​​​​​結​​​​​​​果​​​​​​​:
/dev/md0:
Version : 00.90.00
Creation Time : Mon Mar  1 13:49:10 2004
Raid Level : raid0
Array Size : 15621632 (14.90 GiB 15.100 GB)
Raid Devices : 4
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Mon Mar  1 13:49:10 2004
State : dirty, no-errors
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0

Chunk Size : 64K

      Number   Major   Minor   RaidDevice State
         0       8        1        0      active sync   /dev/sda1
         1       8       17        1      active sync   /dev/sdb1
         2       8       33        2      active sync   /dev/sdc1
         3       8       49        3      active sync   /dev/sdd1
           UUID : 25c0f2a1:e882dfc0:c0fe135e:6940d932
         Events : 0.1