How can I make Grub recognise my old Linux Partition

4

Problem:
I have two partitions. On one I have installed Fedora 9 and on my other partition I just installed Fedora 12. Now that I've installed Fedora 12 I can't get Grub to boot the old partition. How can I configure Grub to boot to my old fedora partition?

Some Notes:

  • My Fedora 9 seems to show up as Linux LVM instead of just Linux in fdisk. I had virtual box installed on that Linux, but it isn't a virtual machine itself.
  • I'm pretty sure Fedora 12 installs grub instead of grub2
  • I can see and mount both partitions from the Fedora 12 live CD if that helps
  • My box is 64 bit.

Info:
This is what I get from 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

And this is what is currently in my 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

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

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

Robbie

Posted 2010-02-10T14:26:34.067

Reputation: 155

yes! looks like your FC9 was using /dev/sda2 as it's non-LVM /boot partition. good job, both with crafting this question and working with us to find your solution. – quack quixote – 2010-02-10T15:38:29.727

you probably want to change pertition to partition – phunehehe – 2010-02-10T16:29:16.550

@phunehehe: fixed! – quack quixote – 2010-02-10T17:10:13.813

Answers

5

LVM isn't "Linux Virtual Machine", it's "Logical Volume Manager". If I understand LVM correctly, to boot to a root partition on LVM, you need a separate /boot partition outside of the LVM (was that the small partition on /dev/sda2?). Your system may still have this, but if your FC12 installation overwrote it, recovery will be much more difficult.

Here's a couple of links to Grub vs LVM problems: link 1, link 2

Also see "Mounting a Linux LVM volume" -- you should be able to verify that your old FC9 system is still OK by mounting and examining its root partition while booted into FC12. If so, you can probably recover fairly easily, even if you've overwritten the FC9 /boot partition.

Here's an example Grub boot entry for an LVM system (source). In this case, (hd0,0) (meaning /dev/sda1) is a small /boot partition, and the rest of the system resides on an LVM on /dev/sda2. Note the root= and lvm2root= entries on the kernel line:

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

Postmortem: This user ended up with the best-case scenario. The FC12 installation didn't overwrite or reformat FC9's /boot partition, /dev/sda2, and all that was needed was to access FC9's old /boot/grub/menu.lst and copy the boot entries into FC12's Grub menu.

quack quixote

Posted 2010-02-10T14:26:34.067

Reputation: 37 382

I went through the steps to mount my FC9 system and it worked. Everything look in place. Also when I did that a /boot entry showed up under places for /media/_boot Looking in there I can see the grub folder and all the old entries for grub on my last install. I've updated it in the main question so it's more readable. Should I just stick all that info for that Fedora into my new Grub menu? – Robbie – 2010-02-10T15:25:21.770

1@Robbie: great! maybe your FC9 /boot is on the LVM? dunno. anyway, you can just copy the kernels and initrd images from FC9's /boot into FC12's /boot (make sure you give them unique names; don't overwrite anything), then add the boot entries from FC9's Grub menu into FC12's, and you're good to go. make sure you point them to the right root (hdX,Y) to find the kernel & initrd images. – quack quixote – 2010-02-10T15:31:28.560

Yea! I copied everything from the info of that menu.lst into the new grub and I am now speaking to you from the firefox on my old Fedora 9 system. Thanks for all the help! – Robbie – 2010-02-10T15:34:08.973

0

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
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.31.12-174.2.3.fc12.x86_64 ro root=*****  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

See where I wrote root=***** ? Either get the UUID for hd0,3 or just write root=/dev/hda3 or /dev/sda3 there. And .. It should be fine, if that's the correct partition.

Trevoke

Posted 2010-02-10T14:26:34.067

Reputation: 408

1Does it not matter that it'll be using the kernel specified for Fedora 12? And should root still be (hd0,0) for the Fedora 9 entry? – Robbie – 2010-02-10T14:36:08.560

1it probably shouldn't be using an FC12 kernel to boot FC9. it might work, but lots of things will probably break. – quack quixote – 2010-02-10T14:47:10.363

I tried this and got an error:
No root device found [drm:drm_mode_rmfb] *Error* tried to remove a fb that we didn't own Boot has failed, sleeping forever
– Robbie – 2010-02-10T14:50:03.930

If I download the RPM for the kernel for 9 and install it, will that cause problems in my Fedora 12 install? http://rpm.pbone.net/index.php3/stat/4/idpl/13342106/com/kernel-2.6.27.25-78.2.56.fc9.x86_64.rpm.html

– Robbie – 2010-02-10T15:00:58.823

1don't use RPM or yum to install it while booted into FC12. you might need to extract the files manually though. – quack quixote – 2010-02-10T15:02:53.280

Looks like quack was correct. You'll need to find the kernel and inital ramdisk(initrd) that Fedora 9 uses and substitute them into your menu.lst – Kevin M – 2010-02-10T15:09:15.157