Page 1 of 1

GRUB menu.lst boot to SATA RAID

Posted: Wed Jan 17, 2007 6:17 pm
by jayshields
Right,

I've been Googling a while now and asked my friend who knows about this stuff, and still no luck.

What I've done is cloned my IDE Windows HDD onto my new SATA drive. It's worked fine.

If I run sudo fdisk -l in a terminal I get this:

Code: Select all

jay@jay-desktop:~$ sudo fdisk -l
Password:

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       30401   244196001    7  HPFS/NTFS

Disk /dev/hda: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        4839    38869236    7  HPFS/NTFS
/dev/hda2            4840        9752    39463672+  83  Linux
/dev/hda3            9753        9964     1702890    5  Extended
/dev/hda5            9753        9964     1702858+  82  Linux swap / Solaris

Disk /dev/hdb: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1        4998    40146403+   7  HPFS/NTFS
Top entry being my new drive, middle one being my current Ubuntu drive and bottom one being my old Windows drive.

I want to change menu.lst so that I can boot to my new Windows drive, but I don't understand how the drive references relate to each other between what fdisk returns and what's in menu.lst.

My menu.lst entires look like this:

Code: Select all

title		Windows XP Pro
root		(hd0,0)
savedefault
makeactive
chainloader	+1

title		Ubuntu
root		(hd0,1)
kernel		/boot/vmlinuz-2.6.17-10-generic root=/dev/hda2 ro quiet splash
initrd		/boot/initrd.img-2.6.17-10-generic
quiet
boot
I know hd([partition number],[drive number]), that's about as far as my learning has got to.

So, my question is, what do I put into menu.lst so that I can boot to my new drive?

I've tried this:

Code: Select all

title		New Windows XP Pro
root		(hd0,2)
savedefault
makeactive
chainloader	+1
but it was a complete stab in the dark, and I got a "device not recognised" error.

My friend also said if you invoke a GRUB shell there is a command to list the drives but he doesn't remember it, I can't find this command anywhere.

Thanks for any help :)

Posted: Wed Jan 17, 2007 6:53 pm
by jayshields
Alright, now I'm totally confused.

I've done some more reading, finally found out that the drives need to be mapped in my device.map file. Currently it looks like this:

Code: Select all

(hd0)	/dev/hda
(hd1)	/dev/hdb
I added this line:

Code: Select all

(hd2)	/dev/sda
to it, so that it maps my new drive.

Then, I presumed what I tried before in menu.lst would work, nope, same error.

The thing that confuses me the most, is that the mapping is all wrong!

Ubuntu > /dev/hda > hd0 > hd(0,1)
Old Windows > /dev/hdb > hd1 > hd(0,0)

I really don't understand that. Maybe my interpretation of the syntax of hd(x,x) is wrong...

Posted: Wed Jan 17, 2007 7:03 pm
by volka
move the current device.map to device.map.bak (or delete it), run grub-install --recheck and then check the device.map again.

Posted: Wed Jan 17, 2007 7:59 pm
by jayshields
Thanks volka, that got me somewhere.

I ran

Code: Select all

sudo grub-install --recheck /dev/hda1
which got the device.map sorted (just changed to what I tried but added an fd0 line...).

I've now figured out that it's hd([drive no],[partition no]); which is weird, because that means windows and ubuntu boot from the same drive.

Anyway, when changing my menu.lst entry for my New Windows install to this

Code: Select all

root hd(2,0)
it says "Starting up...", like it should. Then on the line underneath prints about 6 characters worth of rubbish, and hangs. Ctrl+Alt+Del causes reboot, but that's all that does anything.

I'm presuming this is because when I ghosted the drive, it didn't clone the booting bit properly. If this makes any difference, I ghosted the HDD through a Windows based GUI (running on the source drive), which suprised me, because I thought I'd have to boot from the disc and do it through there for it to be able to clone the drive (including the boot sector) properly. Before I go wiping my new drive and trying to clone it like that, do you reckon that's it?

Thanks.

Posted: Wed Jan 17, 2007 8:11 pm
by Jenk
Windows and Ubuntu will boot from the same partition, because the "root" that grub or NTLDR want is not the same "root" within Ubuntu (/)

This is what my menu.lst looks like (I have the installs the other way round - note I have to re-map the drives in reverse order to trick NTLDR into thinking it is installed on the master drive.)

Code: Select all

john@localhost ~ $ cat /boot/grub/grub.conf
# Boot automatically after 10 secs.
timeout 10

default 1

splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title=Gentoo Linux (Fallback)
kernel (hd0,0)/boot/backup root=/dev/hda3

title=Gentoo Linux
kernel (hd0,0)/boot/current root=/dev/hda3

title=Windows XP Pro
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,0)
chainloader +1
john@localhost ~ $

Code: Select all

john@localhost ~ $ sudo fdisk -l

Disk /dev/hda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1           5       40131   83  Linux
/dev/hda2               6          68      506047+  82  Linux swap / Solaris
/dev/hda3              69       30401   243649822+  83  Linux

Disk /dev/hdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *           1        1275    10241406    7  HPFS/NTFS
john@localhost ~ $
You'd probably want:

Code: Select all

default 0
timeout 10

#Windows
title=Windows
rootnoverify (hd0,0)
chainloader +1

title=Ubuntu
kernel (hd1,0)/boot/vmlinuz-2.6.17-10-generic root=/dev/hda2 ro quiet splash
initrd (hd1,0)/boot/initrd.img-2.6.17-10-generic
assuming /dev/sda is your master drive. If it's not, either switch it via the jumper and/or bios, or use the re-mapping trick as in mine.

Posted: Wed Jan 17, 2007 8:30 pm
by volka
You want to boot from the partition linux sees as /dev/sda1 and device.map says (hd2) /dev/sda ?
Then it should be

Code: Select all

default 1
fallback 0
timeout 10

title Windows XP Pro
rootnoverify (hd2,0)
makeactive
chainloader +1

title Ubuntu
root (hd0,1)
kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/hda2 ro quiet splash
initrd /boot/initrd.img-2.6.17-10-generic

Posted: Thu Jan 18, 2007 8:44 am
by jayshields
Oh dear. I can't boot into either Windows install anymore now!

Seems the confusing hd(x,x) syntax has been cleared up because I hadn't tried booting into my old Windows install since I did the grub-install --recheck thing, and then when I tried this morning it just looped back to the GRUB menu, which makes sense because it was pointing to partition 0 on my ubuntu drive (whereas ubuntu points to partition 1).

So, I changed my old working Windows install entry in menu.lst to root hd(1,0) and changed my new Windows install to rootnoverify hd(2,0); I don't have a clue what rootnoverify is and how it is different to root, by the way.

Now, the new install does the same as it was doing before, pritining "Starting up..." and then underneath printing about a 1/3 of a line of weird characters, but, to make matters worse, when I boot to my old working Windows install it did exactly the same! So this cancels out the idea that the ghosting went wrong.

So, to put things into prespective. Windows used to boot when GRUB was pointing to my ubuntu drive at 0 partition. After grub-install --recheck this entry made it loop the GRUB menu. When changed to point to the proper device/partition, it prints "Starting up...", roughly 10 weird characters, then hangs.

menu.lst:

Code: Select all

title		Old Windows XP Pro
root		(hd1,0)
#savedefault
makeactive
chainloader	+1

title		New Windows XP Pro
rootnoverify	(hd2,0)
#savedefault
makeactive
chainloader	+1

title		Ubuntu
root		(hd0,1)
kernel		/boot/vmlinuz-2.6.17-10-generic root=/dev/hda2 ro quiet splash
initrd		/boot/initrd.img-2.6.17-10-generic
quiet
boot
device.map:

Code: Select all

(fd0)	/dev/fd0
(hd0)	/dev/hda
(hd1)	/dev/hdb
(hd2)	/dev/sda
My fdisk list looks the same as in the first post.

EDIT
-----
Things can only get worse...

Tried some of the stuff you suggested before Jenk, I think I'm getting warmer.

Code: Select all

title		Old Windows XP Pro
root		(hd1,0)
#savedefault
makeactive
chainloader	+1
map (hd0) (hd1)
map (hd1) (hd0)
#chainloader (hd1,0)+1
I've tried numerous combinations using the 2 map lines, and I always get NTLDR is missing on the "Starting up..." page. Research into this always leads me to something along the lines of "Windows doesn't like not being on the first HDD, you need to do this" which usually leads back to using the map lines, or re-arranging all your hard drives so the boot partition is somewhere, which seems very long winded.

I've read stuff about changing the boot order in the BIOS, but I though the boot order depended on which drive is set to master and slave rather than in BIOS.

Please someone throw me an idea!!!!!

Posted: Thu Jan 18, 2007 10:07 am
by Jenk
try manualling booting into windows at the grub console (on boot, choosing option 'c' when grub loads)

enter the following (press enter for each new line):

Code: Select all

rootnoverify (hd2,0)
chainloader +1
makeactive

Posted: Thu Jan 18, 2007 10:21 am
by jayshields
I don't think it's to do with GRUB anymore because I just went into BIOS and changed my HDD boot order, tried putting both the new drive and the old windows drive at first spot and I got the NTLDR is missing message for both. I put the Ubuntu drive back to first spot and GRUB comes up and lets me boot ubuntu again... I think the mapping thing is correct for menu.lst because I get the same message, I just need to get rid of NTLDR is missing.

Any ideas?

Posted: Thu Jan 18, 2007 8:12 pm
by Jenk
Yes, check that the files:
  • ntdetect.com
    ntldr
are in the root of what would be your C: drive. (i.e. 'C:\ntldr' and 'C:\ntdetect.com')

If you don't have them, they can be found on the windows image in the x:\i386\system folder.

If they are there, then you need to 'fool' windows into thinking it is the master (hd0) drive - sometimes the bootorder in the bios is not enough, so you need to remap them in grub, as I did. Yours would need:

Code: Select all

title      New Windows XP Pro
map (hd2) (hd0)
map (hd0) (hd2)
rootnoverify   (hd2,0)
#savedefault
makeactive
chainloader   +1

Posted: Fri Jan 19, 2007 12:30 pm
by jayshields
That sounds all well and good, but how am I supposed to put these files onto the (NTFS) drives?

I don't have the files you mentioned in the drives, and can never remember having them, so this makes sense to me, because both drives have the same problem, and the ghosted drive doesn't have the files either (obviously).

I've put my Windows disc in, dragged the files to my desktop, now all I need to do is put them on the Windows drives to test! I asked my "clued-up" friend and he reckons it's a reasonable solution, so, fingers crossed, this should work.

I read about an experimental package that you can install so that you can write to NTFS from *nix, is this worth trying or do you have a better idea?

Thanks alot.

Posted: Fri Jan 19, 2007 2:07 pm
by jayshields
IT WORKSSSSSSSSS!

I used ntfsmount (after more trouble, this time with fusermount) that I mentioned before, and it woked a treat. Great!

Windows said something along the lines of "Invalid boot.ini, booting from C:", and it worked...

Funny thing is, I just realised I don't actually have a boot.ini file either! I'm gunna try making my own from scratch.

Thanks everyone (Jenk in particular :))

Posted: Fri Jan 19, 2007 11:24 pm
by Jenk
No probs. :)

I also forgot to suggest you can use the windows disk recovery console to recreate/copy ntldr and ntdetect.com.

You don't need a boot.ini, infact you're probably better off without one as it is NTLDR's equivalent of grub's menu.lst.

Posted: Sat Jan 20, 2007 2:26 am
by jayshields
My friend suggested the Windows Recovery Console too, but isn't it DOS based? I'd have to know the commands and stuff, which I don't. Anyway, that's sorted now. Obviously I have a few more problems...

The drive Ubuntu is on (C: from Windows) has a 40gb partition at the beginning of the drive which I used as an extra storage space from Windows. For some reason, Windows now says "This drive is not formatted, format now?" whenever I try to go into it. I'm also having trouble mounting it from in Ubuntu.

Other problems are that Windows (on the new drive) has a few weird problems. For example, my sound card doesn't work (I can probably fix that with a bit more messing) and also whenever I try to access User Accounts from the Control Panel, "Microsoft HTML Application" crashes and User Accounts won't open.

Any ideas what's going on there?