我已经在新服务器上安装了 Ubuntu 12.04.1,并设置了 4 个硬盘驱动器,其中 3 个是 RAID 1 设备,配置如下:前两个驱动器有 md0(交换空间)和 md1(/),第三和第四个驱动器有 md2(/var)。
我一直在驱动器故障的情况下测试操作,发现如果我移除磁盘 2,系统可以正常启动,但如果我移除磁盘 1,系统就会进入 grub 然后重新启动。我很困惑为什么 grub 似乎可以从磁盘 2 正确加载,但随后启动失败。
我尝试将 MBR 从磁盘 1 复制到 2:
dd if=/dev/sda of=/dev/sdb bs=512 count=1
但这并没有什么区别。
有什么想法可以使它仅从第二个磁盘启动吗?
fdisk -l
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ccfa5
Device Boot Start End Blocks Id System
/dev/sda1 2048 31250431 15624192 fd Linux RAID autodetect
/dev/sda2 * 31250432 3907028991 1937889280 fd Linux RAID autodetect
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ccfa5
Device Boot Start End Blocks Id System
/dev/sdb1 2048 31250431 15624192 fd Linux RAID autodetect
/dev/sdb2 * 31250432 3907028991 1937889280 fd Linux RAID autodetect
Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00035b05
Device Boot Start End Blocks Id System
/dev/sdd1 2048 3907028991 1953513472 fd Linux RAID autodetect
Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c73aa
Device Boot Start End Blocks Id System
/dev/sdc1 2048 3907028991 1953513472 fd Linux RAID autodetect
Disk /dev/md1: 1984.3 GB, 1984264208384 bytes
2 heads, 4 sectors/track, 484439504 cylinders, total 3875516032 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/md2: 2000.3 GB, 2000263380992 bytes
2 heads, 4 sectors/track, 488345552 cylinders, total 3906764416 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/md0: 16.0 GB, 15990652928 bytes
2 heads, 4 sectors/track, 3903968 cylinders, total 31231744 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
答案1
这是一个长期存在的 grub 错误,您可以通过以下方式修复它:
/etc/defalt/grub
:
# Uncomment to disable graphical terminal (grub-pc only)
GRUB_TERMINAL=console
PS:如果您不仅想要速度,还想要可靠的冗余,那么 raid 上的 Swapfiles 是一个不错的选择(不幸的是,Ubuntu 的 raid 实现并不像它应该的那样可靠)。