克隆 Ubuntu 后,如何在具有 RAID 1 设置的专用分区上重新安装 GRUB?

克隆 Ubuntu 后,如何在具有 RAID 1 设置的专用分区上重新安装 GRUB?

由于我的开发服务器出现 Kernel Panic,我最终重新安装了它。我认为,如果我使用我的云备份解决方案将完整的服务器备份从生产服务器恢复到开发服务器,我将获得与生产服务器更相似的配置,而不是再次手动安装所有内容。

因此,两台服务器上的操作系统都是 Ubuntu 16.04,尽管恢复过程很顺利,但当我更改 SSH 配置并重新启动开发服务器时,我发现了一个需要修复的重要新问题 - 磁盘分区 UUID 是错误的,因为文件系统是从不同的物理设备恢复的。

我能够启动到 GRUB(不知道是什么版本,找不到如何检查),但搜索后发现它毫无用处,反而认为我需要重新安装 GRUB。我成功启动到开发服务器上的 Rescue 内核,并仔细尝试理解和学习如何正确执行此 GRUB 重新安装。

我发现的最佳资源是此 StackExchange 帖子,但由于我的尝试不符合我的预期,我意识到这篇文章不是关于 RAID1 的,而我拥有的就是 RAID1。此外,我相信我有一个专用的 GRUB 分区。

我无法挂载 /dev/sda# 和 /dev/sdb# 分区,我收到类似的消息mount: unknown filesystem type 'linux_raid_member'

因此,我(我认为)从fdisk -l下面的输出中了解到:

  • /dev/sda1-3 是操作系统的主分区
  • /dev/sdb1-3 是 sda 的镜像 RAID 分区
  • /dev/md127 是多设备代表由 sda 和 sdb 组成的 RAID1 分区
  • 我猜 /dev/md126 是专用的 GRUB 分区,因为我注意到人们为此创建了 1 MB 的分区

输出fdisk -l救援 64 位 4.x 内核

Disk /dev/ram0: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram1: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram2: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram3: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram4: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram5: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram6: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram7: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram8: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram9: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram10: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram11: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram12: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram13: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram14: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram15: 80 MiB, 83886080 bytes, 163840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/loop0: 77 MiB, 80732160 bytes, 157680 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 /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 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
Disklabel type: dos
Disk identifier: 0xcdb133c6

Device     Boot    Start       End   Sectors   Size Id Type
/dev/sda1           2048   2050047   2048000  1000M fd Linux raid autodetect
/dev/sda2        2050048  10049535   7999488   3.8G 82 Linux swap / Solaris
/dev/sda3       10049536 468860927 458811392 218.8G fd Linux raid autodetect

Disk /dev/sdb: 223.6 GiB, 240057409536 bytes, 468862128 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
Disklabel type: dos
Disk identifier: 0x41d48153

Device     Boot    Start       End   Sectors   Size Id Type
/dev/sdb1           2048   2050047   2048000  1000M fd Linux raid autodetect
/dev/sdb2        2050048  10049535   7999488   3.8G 82 Linux swap / Solaris
/dev/sdb3       10049536 468860927 458811392 218.8G fd Linux raid autodetect

Disk /dev/md127: 218.8 GiB, 234911236096 bytes, 458811008 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 /dev/md126: 1000 MiB, 1048510464 bytes, 2047872 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

我不愿意简单地挂载 /dev/md126 并使用它来安装 GRUB,因为我看到其他指南使用该mdam实用程序并处理所有这些不同的分区 - 并不像没有 RAID 那样简单和简短。

本指南适用于 RAID1没有提到专用的 GRUB 分区,甚至没有运行 GRUB 安装,所以我怀疑它是否适合我的情况?

那么我应该如何正确处理这种情况,并在这台开发服务器(从单独的生产服务器克隆)上重新设置 GRUB 和 RAID1?非常感谢您的回答!

相关内容