Software-Raid

RAID 故障後如何啟動(軟體 RAID)?

  • September 28, 2013

以前,我使用 ( mdadm) 的驅動器sdasdb. sdb失敗,重新啟動系統的唯一方法是拔下第二個硬碟驅動器。

現在我添加了新的sdbsdc我的 RAID 設置。sda是最舊的(因此最有可能失敗),它是我們啟動的驅動器(我想,我該如何檢查?)。

我如何確保和測試(通過 GRUB 配置等)如果sda失敗,我仍然能夠引導我的機器。

fdisk -l:

Disk /dev/sda: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000080

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       30064   241489048+  fd  Linux raid autodetect
/dev/sda2           30065       30394     2650725    5  Extended
/dev/sda5           30065       30394     2650693+  fd  Linux raid autodetect

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

  Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       30064   241489048+  fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.
/dev/sdb2           30065       30394     2650725    5  Extended
/dev/sdb5           30065       30394     2650693+  fd  Linux raid autodetect
Partition 5 does not start on physical sector boundary.

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

  Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1       30064   241489048+  fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.
/dev/sdc2           30065       30394     2650725    5  Extended
/dev/sdc5           30065       30394     2650693+  fd  Linux raid autodetect
Partition 5 does not start on physical sector boundary.

Disk /dev/md0: 247.3 GB, 247284695040 bytes
2 heads, 4 sectors/track, 60372240 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Alignment offset: 512 bytes
Disk identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/md1: 2714 MB, 2714238976 bytes
2 heads, 4 sectors/track, 662656 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Alignment offset: 512 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

這是一個老栗子。簡短的回答是“grub-install”通常是軟體 RAID 的錯誤答案。這是一個範例,其中我有一個 3 路 RAID-1 陣列。/boot 分區儲存在 /dev/md0。這會將 GRUB 安裝到每個磁碟,因此如果一個磁碟發生故障,您可以從其他磁碟之一啟動。

# grub
grub> find /grub/stage1
(hd0,0)
(hd1,0)
(hd2,0)
grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)
grub> device (hd0) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)
grub> device (hd0) /dev/sdc
grub> root (hd0,0)
grub> setup (hd0)
grub> quit

在 GRUB 的未來版本中,它會更加智能,但 CentOS 6 / RHEL 6 仍然隨舊版 GRUB 一起提供。

測試:將 grub.conf 文件(在 /boot 下)中的“timeout=5”值更改為 timeout=30。然後在重新打開系統電源之前交換兩個驅動器的位置。或者在 BIOS 中更改硬碟驅動器的引導順序。

(當然…確保您有良好的備份並知道如何將其恢復到正確的配置。在一次性系統上測試它總是一個好主意。)

引用自:https://serverfault.com/questions/525066