Linux 用指令檢查 RAID 狀態
先看看 RAID 狀態
[root@liho ~]# mdadm --detail-platform
Platform : Intel(R) Rapid Storage Technology enterprise
Version : 4.5.0.1012
RAID Levels : raid0 raid1 raid10 raid5
Chunk Sizes : 4k 8k 16k 32k 64k 128k
2TB volumes : supported
2TB disks : supported
Max Disks : 8
Max Volumes : 2 per array, 4 per controller
I/O Controller : /sys/devices/pci0000:00/0000:00:1f.2 (SATA)
Port0 : /dev/sda (P02724108934)
Port1 : /dev/sdb (P02724108469)
Port2 : /dev/sdc (BTYS834502XJ3P8EGN)
Port3 : /dev/sdd (H567360418)
Port4 : - no device attached -
Port5 : - no device attached -
正常沒問題的狀態會是下面這樣:看到 md126 的 [UU] 就是代表沒問題(”U” 代表 UP)。
[root@liho ~]# cat /proc/mdstat
Personalities : [raid1]
md125 : inactive sdd[0](S)
1105 blocks super external:imsm
md126 : active raid1 sda[1] sdb[0]
475109376 blocks super external:/md127/0 [2/2] [UU]
md127 : inactive sda[1](S) sdb[0](S)
10402 blocks super external:imsm
unused devices: <none>
在狀態沒問題的時候 可以看到兩個 “active sync”
[root@liho ~]# mdadm -D /dev/md126
/dev/md126:
Container : /dev/md/imsm0, member 0
Raid Level : raid1
Array Size : 475109376 (453.10 GiB 486.51 GB)
Used Dev Size : 475109376 (453.10 GiB 486.51 GB)
Raid Devices : 2
Total Devices : 2
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Consistency Policy : resync
UUID : 270c570c:a49daf9b:c0e14b6c:e4a6b30e
Number Major Minor RaidDevice State
1 8 0 0 active sync /dev/sda
0 8 16 1 active sync /dev/sdb
下面的RAID狀態是正在重新建立中 (rebuild),看到 md126 的 [U_] 這邊右邊那個碟 「沒有UP」代表有問題。
[root@liho ~]# cat /proc/mdstat
Personalities : [raid1]
md125 : inactive sdd[0](S)
1105 blocks super external:imsm
md126 : active raid1 sda[1] sdb[0]
475109376 blocks super external:/md127/0 [2/1] [U_]
[=======>.............] recovery = 36.7% (174653440/475109376) finish=29.5min speed=169288K/sec
md127 : inactive sdb[1](S) sda[0](S)
10402 blocks super external:imsm
unused devices: <none>
然後個別看看 /dev/mdXXX 詳細的資訊,下面是 RAID1:
[root@liho ~]# mdadm -D /dev/md126
/dev/md126:
Container : /dev/md/imsm0, member 0
Raid Level : raid1
Array Size : 475109376 (453.10 GiB 486.51 GB)
Used Dev Size : 475109376 (453.10 GiB 486.51 GB)
Raid Devices : 2
Total Devices : 2
State : clean, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1
Consistency Policy : resync
Rebuild Status : 41% complete
UUID : 270c570c:a49daf9b:c0e14b6c:e4a6b30e
Number Major Minor RaidDevice State
1 8 0 0 active sync /dev/sda
0 8 16 1 spare rebuilding /dev/sdb
下面是 spare 碟:
[root@liho ~]# mdadm -D /dev/md125
/dev/md125:
Version : imsm
Raid Level : container
Total Devices : 1
Working Devices : 1
Member Arrays :
Number Major Minor RaidDevice
- 8 48 - /dev/sdd
我不太懂已經有 RAID1 的 md126 為什麼還會有 md127?還是這只是一個 container (容器)?
[root@liho ~]# mdadm -D /dev/md127
/dev/md127:
Version : imsm
Raid Level : container
Total Devices : 2
Working Devices : 2
UUID : 7bed3288:d4b81d88:ab300edb:fffee458
Member Arrays : /dev/md/Volume0
Number Major Minor RaidDevice
- 8 0 - /dev/sda
- 8 16 - /dev/sdb
其他資訊:How to add Hot Spare Volume to the existing mdadm software RAID array