LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (http://www.linuxquestions.org/questions/fedora-35/)
-   -   Need to (re)install GRUB: fedora c4 rescue cd (and GRUB) unable to see the harddisk (http://www.linuxquestions.org/questions/fedora-35/need-to-re-install-grub-fedora-c4-rescue-cd-and-grub-unable-to-see-the-harddisk-420784/)

whencat 03-01-2006 09:31 PM

Need to (re)install GRUB: fedora c4 rescue cd (and GRUB) unable to see the harddisk
 
Scenario:
Pre-problem:
1) Happy system with Windows xp SP2 and Fedora Core 4.
2) Both on a single harddisk - xp on the sole primary partition and FC4 on extended (/boot,/,/home,swap) and other NTFS partitions.
3) Harddisk had an empty 10 GB partition in the extended just after the swap.
4) Partitioned the empty partition into 2 using the Disk management in Adin ools->Compter management in XP.
5) partition table changed = GRUB lost = problem begins.

Problem:

1)booted into the Fedora rescue cd -> chrooted into /mnt/sysimage -> grub-install --recheck /dev/hda
2)/dev/hda:no such device or not a block device.
3)fdisk -l -> cannot open /proc/partition
4)parted -> no device found (smthing like that) -> Retry/Cancel?
5)df -> shows only / and /dev/proc
6)the /dev partition has only one file called "null"
7)I am ABLE to access all my partitions ie. /boot,/,/home but why does the programs (fdisk,parted,grub) unable to see the harddisk.

i even tried taking the image of the /boot partition:
dd if=/dev/hda6 of=linbootsec.img bs=512 count =1
complains -> input file /dev/hda6 cannot be found.

Please suggest ways to restore GRUB.

Any help is greatly appreciated.

Misc info:
p4 system with asus p4p800vm i865 chipset(ICH 5).

Simon Bridge 03-02-2006 01:05 AM

Boot from a live distro and look at the partitions.

Dommy 03-02-2006 07:27 PM

I had this happen with a different distro found I had to use lilo to setup the MBR that allowed me to boot into linux and then I could reinstall grub quite strange

whencat 03-03-2006 03:00 AM

Hello all,
Finally got the problem solved. Although its not quite clear as to what solved it, i did the following after frustrating search and thought:
1)the partition table was obviously altered and hence /etc/fstab had invalid entries reflecting the old structure. =>Removed unwanted entries and tried to make the file a minimal one.

2)By trial and error guessed what could be the root partition number .....found it to be /dev/hda6 and not /dev/hda5 as it was earlier.By keeping this as a reference changed other partition device name entries and rebooted.

3)Bingo! fdisk -l at last gave an output. But i don't understand this. does fdisk read the fstab file for any querying?.....so brushing aside such doubts I issued
Code:

grub-install --recheck /dev/hda
this gave a different error this time stating the file
Code:

/boot/grub/stage1 not read correctly
4)Then I had to painstakingly study the
Code:

info grub
pages and learnt how to install it natively. I think it was easy at the end and I did learn a lot.Thank God I had this problem or else I would'nt have learnt so much.

5)But no, the problems were not yet over. The native install method just gave me a grub prompt from where I could enter commands everytime I wanted to boot. This was ok with me but thinking of my father I badly wanted the menu interface....and then further research(?!!) gave me the perfect answer
Code:

root (hd0,5)
Code:

install /grub/stage1 (hd0) /grub/stage p /grub/menu.lst
Code:

quit
Hope this thing helps someone with a near-similiar problem.

archtoad6 03-05-2006 02:01 PM

Thanks for: a) posting your answer, b) posting this answer.

Very useful to my understanding of the finer/deeper points of GRUB.


BTW,
sfdisk can back up & restore partition tables.

gpart is supposed to fix trashed partition tables. I say "supposed to" because it is complicated & I haven't used it yet.


All times are GMT -5. The time now is 09:21 PM.