LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 01-02-2005, 01:05 AM   #1
tisource
Member
 
Registered: Feb 2002
Posts: 322

Rep: Reputation: 30
Grub fails to boot when not at beginning of hard drive


This might strictly be a hardware limitation, but I wanted to make sure.

My laptop's hard drive recently died (4200 rpm 20 GB Hitachi) and I replaced it with a 40 GB Travelstar 5K80 (HTS548040M9AT00). The hard drive seems to be operating fine, as far as I can tell. I performed a few diagnostics and benchmark tests, and all went well.

The laptop typically has a multiboot configuration on it (windows/linux), so I proceeded to recreate that setup on the new hard drive. Unfortunately, I couldn't do it. On the old hard drive, I once had as many as 4 operating systems on it (networking courses at college often require arduous setups). I installed linux on the forefront of the new drive, and it booted properly. I installed Windows 2000 Professional on the 2nd partition (after some difficulties), and it failed to boot. So, I reinstalled linux, putting Windows on the forefront, and linux on the back, thinking linux would be less picky about where it was installed than Windows. Unfortunately, linux (in this case, Fedora Core 3) wouldn't boot either (grub simply hangs at the 2nd stage message).

I know this could be a simple hardware limitation, but as linux is very versatile, I thought there might a simple fix for the linux side of things.

Linux fdisk reports some 8,000 cylinders or so, versus the standard 1,024, which I could see complicating things.

I checked my bios to see if there was anything there that might help, but all I can do is change my date/time and reorder boot devices (Phoenix).

Anything I can do, or am I just out of luck?
 
Old 01-02-2005, 06:24 AM   #2
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
Grub can bypass the bios if you give it the geometry. You should be able to get it working with grub on the mbr.

Can you make a grub floppy and see if it will work?

Normally I create a /boot partition on my hard drive and make it a primary partition.

Last edited by DavidPhillips; 01-02-2005 at 06:26 AM.
 
Old 01-02-2005, 02:51 PM   #3
tisource
Member
 
Registered: Feb 2002
Posts: 322

Original Poster
Rep: Reputation: 30
Interesting. I've never put /boot in its own partition.

So your idea is if the boot floppy can make it work, then perhaps a /boot partition would work?

Dumb question, but how do you make a grub boot floppy, and how do you give grub the geometry?
 
Old 01-02-2005, 07:09 PM   #4
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
You need to find your stage1 and stage2 images and use that path or cd to the location first


dd if=stage1 of=/dev/fd0 bs=512 count=1

dd if=stage2 of=/dev/fd0 bs=512 seek=1

If you need to create one from windows you can use these...

http://www.desktop-linux.net/filez/grub.img
http://www.desktop-linux.net/filez/rawrite.exe

run rawrite and create the floppy from the image.


Now boot the floppy and you get a prompt like this..

grub>


check the drive geometry with the manufacturer specs..

grub> geometry (hd0)
drive 0x80: C/H/S = 7296/255/63, The number of sectors = 117210240, /dev/hda
Partition num: 0, Filesystem type unknown, partition type 0xa0
Partition num: 1, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type unknown, partition type 0x82
Partition num: 5, Filesystem type is reiserfs, partition type 0x83
Partition num: 6, Filesystem type is fat, partition type 0xb

If it's wrong then there's your problem. If not continue on.


You need to tell grub where to look for the filesystem..

grub> root (hd0,0)


that would be the primary master first partition


now you need to give the kernel to load..

grub> kernel /boot/vmlinuz


If you use an initrd you can load that like this..

grub> initrd /boot/initrd


finally boot the system

grub> boot


Something else you can do is to type the partial command and press tab (indicated by <tab>)


grub> root (hd0,<tab>
Possible partitions are:
Partition num: 0, Filesystem type unknown, partition type 0xa0
Partition num: 1, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type unknown, partition type 0x82
Partition num: 5, Filesystem type is reiserfs, partition type 0x83
Partition num: 6, Filesystem type is fat, partition type 0xb


that shows your partitions

Also show files like this..

grub> root (hd0,5)/<tab>
Possible files are: bin dev etc lib mnt opt srv tmp var usr boot home proc sbin root media share .reiser
fs_priv


and this..


grub> root (hd0,5)/boot/
Possible files are: boot grub memtest.bin message initrd backup_mbr vmlinux-2.4.21-266-default.gz System
.map-2.4.21-266-default Kerntypes-2.4.21-266-default vmlinuz initrd-2.4.21-266-default config-2.4.21-266-
default vmlinuz-2.4.21-266-default


so you can look at the filenames of the kernel and initrd.

You can also use find like this..

grub> find /boot/grub/stage1
(hd0,5)

You could attempt to bring up your menu using the proper partition like this..

grub> configfile (hd0,5)/boot/grub/menu.lst



Last edited by DavidPhillips; 01-02-2005 at 07:52 PM.
 
Old 01-02-2005, 07:39 PM   #5
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
Ok,

Lets say this is incorrect.

grub> geometry (hd0)
drive 0x80: C/H/S = 7296/255/63, The number of sectors = 117210240, /dev/hda


Then you should set the proper settings in the format C H S

Total sectors will be calculated automatically or you can also give it.


The one above is correct for my drive so if my bios was not recognizing the drive correctly it would need to be set like this...


grub> geometry (hd0) 7296 255 63 117210240


There is a lot of other info on grub in the info pages.



info grub


Last edited by DavidPhillips; 01-02-2005 at 07:42 PM.
 
Old 01-02-2005, 09:15 PM   #6
CSEGuy3
LQ Newbie
 
Registered: Dec 2004
Location: CT
Distribution: FC3
Posts: 5

Rep: Reputation: 0
Not sure if this is exactly what you're looking for, but I used this to setup a dual boot with FC3 and WinXP Pro. I setup XP first then FC3. I think /boot ended being hd7 or something but I found this a little safer than messing with the MBR. I probably could have messed with the whole LBA deal but this worked just fine.
 
Old 01-02-2005, 09:34 PM   #7
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
One more thing,


I mentioned the /boot partition

If you have the free space at the beginning of your hard drive you can do it easily. Otherwise you really are stuck. I normally create one in the first 100MB of space on the primary master ide.

Grub does not require this however so if your already using your disk then don't worry about it.
 
Old 01-02-2005, 11:23 PM   #8
tisource
Member
 
Registered: Feb 2002
Posts: 322

Original Poster
Rep: Reputation: 30
Wow..... thanks for the info.

What about multibooting with Windows 9x? I have also considered doing a linux/9x scenario, where my linux is my main OS, and 9x is reserved for gaming (XP/2K is overkill for my lil' 8 MB video card). Does 98 have to be the first partition on my disc? Or can I do /boot first, then 98 vfat, then linux (ext3)?

I know NT-like OSs are less picky about their environment, but 9x can be very picky.

Thanks...
 
Old 01-03-2005, 04:50 AM   #9
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
Quote:
Originally posted by DavidPhillips

dd if=stage1 of=/dev/fd0 bs=512 count=1

dd if=stage2 of=/dev/fd0 bs=512 seek=1
You've got to be kidding! This really works?

I know that the grub install method usually modifies stage1 to point to the correct location of stage2. Does the default image assume that stage2 is either the next block or the second block of fd0, or what?


tisource: I have had no problem in the past booting any windows OS from another partition (I've been told that DOS 6 and under may have trouble though). The one thing that no Windows system likes is booting from a secondary hard drive. There are ways in both grub and lilo to trick windows into booting from a different drive, but it's easiest if Windows happens to be somewhere on the primary master (in other words, I don't think you'll have a problem).

I could be wrong, but I think GRUB has a limitation around 20 GB. In order to get around it you need to turn on LBA mode. (This might or might not be your problem.)

Good luck!
 
Old 01-03-2005, 04:53 AM   #10
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
P.S, I'm not going to bother finishing the link posted by CSEGuy3. I didn't get very far before I found errors. It's probably mostly correct, but I wouldn't trust it.
 
Old 01-03-2005, 03:35 PM   #11
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
It may be something trivial if you post the error someone can probably help.



The grub boot disk creation is take from the grub info pages.

It will give you the grub> prompt

That's the minimum grub disk, you can do a normal grub install to a floppy if you want. It's more involved.

Last edited by DavidPhillips; 01-03-2005 at 03:36 PM.
 
Old 01-04-2005, 12:30 AM   #12
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
" I didn't get very far before I found errors."

"It may be something trivial if you post the error someone can probably help."

I'm sorry, you misunderstood. There are errors on the web page. I don't have boot errors on my computer. There may or may not be many errors on the page, but I wouldn't trust it. "info grub" (or my preference "pinfo grub") is a much better source of knowledge.

I know there are other ways to make a grub floppy. I'm just surprised that the two 'dd' commands work. I think it's a nifty piece of knowledge to remember (just in case).
 
Old 01-05-2005, 12:13 PM   #13
tisource
Member
 
Registered: Feb 2002
Posts: 322

Original Poster
Rep: Reputation: 30
First, thank you for all the advice.

I did get multiboot to work. I ended up creating a /boot partition, as suggested, then my windows partition next, and linux past that. Everything works great.

Thank you all for your help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing grub to external USB hard drive for later use as internal hard drive dhave Linux From Scratch 2 12-10-2005 09:48 AM
slackware 10.1 fails to detect ATA hard drive zodman Slackware 4 05-06-2005 06:42 AM
Installed GRUB on 3rd hard drive, how do I boot 1st drive? jesusphreak Linux - Newbie 4 04-06-2005 10:34 AM
Grub to access new hard drive and old multi os hard drive ? gedi1 Linux - Hardware 0 06-03-2004 01:01 PM
grub wont boot windows on second hard drive ryan00davis Linux - General 12 05-19-2004 03:13 PM


All times are GMT -5. The time now is 06:19 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration