What information is found in the following excerpt from the file /proc/mdstat? (Choose two.)
Personalities: [raid6] [raid5] [raid4]
md0 : active raid5 sdb1[3] (S) sdc1[7] sda1[4] (S) sdd1[6] sde1[5]
1046528 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [UU_]
[===>.......] recovery = 15.9 % (83808/523264) finish=0.1min
speed=71770K/sec
unused devices: <none>
A. One of the disks in /dev/md0 has failed and a spare disk is used to recreate full redundancy
B. The spare disk /dev/sda1 is used to restore full redundancy after the current recovery
C. The information [UU_] means, that the raid is missing one disk and is not fully redundant
D. The device is using version 1.2 metadata to allow LILO and GRUB Legacy to use /dev/md0 as the boot partition. This would not have been necessary with GRUB2
E. The information [3/2] means that 3 RAID disks belong to the array and 2 disks are spare. Together they equal the number of available disks
題解
「/proc/mdstat」檔案存放著 Linux 核心正在使用的 RAID 資訊。
md0 : active raid5 sdb1[3] (S) sdc1[7] sda1[4] (S) sdd1[6] sde1[5] 這個是在表示 md0 這個軟體模擬的 RAID5 裝置目前正在使用「sdb1」、「sdc1」、「sda1」、「sdd1」和「sde1」這幾個分割區,當作其組成結構的硬碟。中括號「[]」中的數字表示該分割區在這個結構中的裝置編號,使用中的硬碟編號不一定會小於主要硬碟的數量(硬碟被替換過後,新加入的硬碟會使用新的編號),所以不能只用編號來判斷哪些是備援硬碟,而是要看後面有沒有標示「(S)」。備援硬碟是在主要硬碟出問題後才會被系統自動換上。
接著先跳來看 [3/2] [UU_],「[3/2]」的「3」表示用來組成 RAID 的主要磁碟數量,「2」是表示其中正在啟用的硬碟數量,所以「[3/2]」代表著目前有一個硬碟是不啟用的狀態,「[UU_]」則代表著是第三個位置的硬碟為不啟用的狀態。所以此時要有一個備援硬碟要被拿來替換原先第三個位置的硬碟,不然這個 RAID5 就會出問題了。
再回頭看 md0 : active raid5 sdb1[3] (S) sdc1[7] sda1[4] (S) sdd1[6] sde1[5],雖然所有的硬碟編號都在「3」以上,但這並不代表它們都是備援硬碟。「(S)」表示「(S)」左邊的那個硬碟為目前還沒有被使用的備援硬碟,所以「sdb1」和「sda1」是閒置中的備援硬碟。至於沒有標示「(S)」的「sdc1」、「sdd1」和「sde1」,則是目前佔用著這個 RAID5 三個位置的硬碟,其中有一個是在原先的硬碟失效之後才被替換上去的,系統正在對它重建(recovery)資料。等重建完成後,這個 RAID5 就會恢復成 full redundancy 的狀態,而「sdb1」和「sda1」仍然會是閒置中的備援硬碟。
選項 A,正確,有一個硬碟失效,且有一個備援硬碟被替換上去,正在重建資料。
選項 B,錯誤,目前正在進行的重建完成後就會恢復 full redundancy,不需要再用到「/dev/sda1」,它仍然會是閒置中的備援硬碟。
選項 C,正確。
選項 D,錯誤,LILO 和 GRUB Legacy 貌似只能使用版本 <1.0 的元數據,GRUB2 則貌似可以支援版本 >=0.9 的元數據。
選項 E,錯誤,「[3/2]」的「2」是表示正在啟用的硬碟數量,不是備援硬碟的數量。
