RAID 故障(软件 RAID)后如何启动?

RAID 故障(软件 RAID)后如何启动?

mdadm之前,我使用( )个驱动器设置了一个软件 raid ,sda但失败了,重新启动系统的唯一方法是拔下第二个硬盘驱动器。sdbsdb

现在,我已将新的sdb和添加sdc到我的 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

答案1

这是老生常谈了。简而言之,“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 中更改硬盘驱动器的启动顺序。

(当然...确保您有良好的备份并且知道如何将其恢复到正确的配置。在一次性系统上进行测试始终是一个好主意。)

相关内容