如何让 Grub 识别我的旧 Linux 分区

Rob*_*bie 4 linux fedora grub lvm multi-boot

问题:
我有两个分区。在一个分区上我安装了 Fedora 9,在另一个分区上我刚刚安装了 Fedora 12。现在我已经安装了 Fedora 12,我无法让 Grub 引导旧分区。如何配置 Grub 以引导到我的旧 Fedora 分区?

一些注意事项:

  • 我的 Fedora 9 似乎在 fdisk 中显示为 Linux LVM 而不是 Linux。我在那个 Linux 上安装了虚拟机,但它本身不是虚拟机。
  • 我很确定 Fedora 12 安装的是 grub 而不是 grub2
  • 如果有帮助,我可以从 Fedora 12 live CD 中查看并挂载两个分区
  • 我的盒子是 64 位的。

信息:
这是我得到的fdisk -l

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005745c

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       64685   519578624   83  Linux
/dev/sda2           65706       65730      200812+  83  Linux
/dev/sda3           65731       91201   204595807+  8e  Linux LVM
/dev/sda4           64686       65705     8193150    5  Extended
/dev/sda5           64686       65705     8192000   82  Linux swap / Solaris
Run Code Online (Sandbox Code Playgroud)

这就是我目前的内容menu.lst

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu

title Fedora (2.6.31.12-174.2.3.fc12.x86_64)
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.31.12-174.2.3.fc12.x86_64 ro root=UUID=876dd1b5-104a-46de-b5fb-08f96d2ce420  LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet mem=8192M
    initrd /boot/initramfs-2.6.31.12-174.2.3.fc12.x86_64.img
title Fedora 9
    rootnoverify (hd0,3)
    chainloader +1
Run Code Online (Sandbox Code Playgroud)

The first fedora in that list is Fedora 12 which boots correctly, the second was just a guess as to where my Fedora 9 install was. When I select that in Grub on boot it goes to a blank screen with a blinking cursor that doesn't respond to the keyboard.

Update:
I was able to mount my old FC9 system and in the /boot section I found this under menu.lst if that helps:

title Fedora (2.6.27.25-78.2.56.fc9.x86_64)
    root (hd0,1)
    kernel /vmlinuz-2.6.27.25-78.2.56.fc9.x86_64 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
    initrd /initrd-2.6.27.25-78.2.56.fc9.x86_64.img
Run Code Online (Sandbox Code Playgroud)

Question:
What do I need to do to boot into my old Fedora?

qua*_*ote 5

LVM 不是“Linux 虚拟机”,而是“逻辑卷管理器”。如果我正确理解 LVM,要引导到 LVM 上的根分区,您需要在 LVM之外有一个单独的/boot分区(那是/dev/sda2上的小分区吗?)。您的系统可能仍然有这个,但如果您的 FC12 安装覆盖了它,恢复将更加困难。

这是 Grub 与 LVM 问题的几个链接:链接 1链接 2

另请参阅“安装 Linux LVM 卷” ——您应该能够通过在引导到 FC12 时安装和检查其根分区来验证您的旧 FC9 系统是否仍然正常。如果是这样,即使您已经覆盖了 FC9 /boot分区,您也可以很容易地恢复。

这是 LVM 系统的 Grub 引导条目示例()。在这种情况下,(hd0,0)(表示/dev/sda1)是一个小的/boot分区,系统的其余部分驻留在/dev/sda2上的 LVM 上。注意内核行上的root=lvm2root=条目:

title Debian GNU/Linux, kernel 2.6.26 Using LVM with SATA Disk
root (hd0,0)
kernel /vmlinuz-2.6.26 root=/dev/ram0 lvm2root=/dev/mapper/sda_vol-root
initrd /initrd-lvm2-2.6.26.gz
Run Code Online (Sandbox Code Playgroud)

事后分析:这个用户最终得到了最好的情况。FC12 安装没有覆盖或重新格式化 FC9 的/boot分区/dev/sda2,所需要的只是访问 FC9 的旧/boot/grub/menu.lst并将引导条目复制到 FC12 的 Grub 菜单中。