View previous topic :: View next topic |
Author |
Message |
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Fri Apr 04, 2008 7:00 am Post subject: Need help with grub config |
|
|
So I want to install grub to MBR on both /dev/sda and /dev/sdb (like described here http://gentoo-wiki.com/HOWTO_Install_on_Software_RAID) but
I do not get
grub> find /boot/grub/stage1
(hd0,0)
(hd1,0)
grub>
I get
grub> find /boot/grub/stage1
(hd0,1)
and this relates to the inital installation to /dev/sda2 I did. Now / filesystem is placed in /dev/sdb1 as a raid1 partition, and /dev/sda will be completely erased and re-partitioned so any link to /dev/sda2 might not be very good to have after reformating.
So, question 1:
How do I install grub to sdb?
I tried but here is the result:
grub> device (hd0) /dev/sdb
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no
Error 2: Bad file or directory type
Eehh?? Can someone please help me with this mess? |
|
Back to top |
|
|
vad3r Guru
Joined: 02 May 2004 Posts: 461 Location: Munich, Germany
|
Posted: Fri Apr 04, 2008 11:50 am Post subject: |
|
|
Is your raid in sync?? Have a look at /proc/mdstat
Looks like your second disk has not the same data... _________________ -- http://www.linuxaddicted.de/ | Please help to answer open questions |
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Mon Apr 07, 2008 6:32 am Post subject: |
|
|
No, I have made sdb a raid disk, sda will be completely erased and re-partitioned and then become a part of the raid system. So it is a one-disk only raid 1 system right now. And all I wish to do is to get grub into the sdb disk, be able to disconnect sda and be able to boot from sdb.
I really do not understand what I'm doing wrong here. |
|
Back to top |
|
|
vad3r Guru
Joined: 02 May 2004 Posts: 461 Location: Munich, Germany
|
Posted: Mon Apr 07, 2008 8:54 am Post subject: |
|
|
According to your first post sdb is missing the data grub needs to install: stage_15 .......
Why not setup your right and then install grub. This will make your life a lot easier _________________ -- http://www.linuxaddicted.de/ | Please help to answer open questions |
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Mon Apr 07, 2008 9:43 am Post subject: |
|
|
vad3r wrote: | According to your first post sdb is missing the data grub needs to install: stage_15 .......
Why not setup your right and then install grub. This will make your life a lot easier |
Yes that would be a perfect solution, to set it up correctly. But I must admit I have no idea, and I'll happily try everything anyone suggest to do this.
Code: |
# ls /boot/grub/
device.map fat_stage1_5 grub.conf iso9660_stage1_5 menu.lst reiserfs_stage1_5 stage1 stage2.old ufs2_stage1_5 xfs_stage1_5
e2fs_stage1_5 ffs_stage1_5 grub.conf.sample jfs_stage1_5 minix_stage1_5 splash.xpm.gz stage2 stage2_eltorito vstafs_stage1_5
|
So, no stage_15.. and I have no clue how to get it.
Really, I have no idea. and I get errors when I tried something like
# grub
devei (hd0) /dev/sdb
root (hd0,0)
setup (hd0)
So any ideas? |
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Mon Apr 07, 2008 11:53 am Post subject: |
|
|
Any ideas on how to install grub into a disk with raid1 and autodetect? |
|
Back to top |
|
|
vad3r Guru
Joined: 02 May 2004 Posts: 461 Location: Munich, Germany
|
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Mon Apr 07, 2008 1:18 pm Post subject: |
|
|
vad3r wrote: | Please post exactly what's your setup:
* Both disks partitioned?
* Software raid created? (Post /proc/mdstat)
* Content of /boot/* on both disks.
You should follow the howto http://gentoo-wiki.com/HOWTO_Install_on_Software_RAID to setup your raid corrently. Installing grub is probably the last task in your install... |
I've tried to follow
http://gentoo-wiki.com/HOWTO_Migrate_To_RAID since I have a system that I can not mess up and reinstall since the machine is used all the time.
Well here is the info you requested
Code: |
fdisk -l /dev/sda
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x001a0019
Device Boot Start End Blocks Id System
/dev/sda1 * 1 5099 40957686 7 HPFS/NTFS
/dev/sda2 5100 30631 205085790 83 Linux
/dev/sda3 30632 38913 66525165 83 Linux
# fdisk -l /dev/sdb
Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xfe7bfe7b
Device Boot Start End Blocks Id System
/dev/sdb1 1 28450 228524593+ fd Linux raid autodetect
/dev/sdb2 28451 38542 81063990 fd Linux raid autodetect
/dev/sdb3 38543 38913 2980057+ 82 Linux swap / Solaris
|
sdb is the disc with the raid system and sda should get the system also. sda contains the original installation and an old windows installation and I'm afraid of doing anything to it before I see that I can run the system with only the sdb disc in the box. But as soon as I can do that, sda will be reformated.
And yes, sdb has softwaer raid.
Code: |
# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb2[1]
81063872 blocks [2/1] [_U]
md0 : active raid1 sdb1[1]
228524480 blocks [2/1] [_U]
unused devices: <none>
|
and
Code: |
# find /boot/
/boot/
/boot/memtest86plus
/boot/memtest86plus/memtest.bin
/boot/config-2.6.23-gentoo-r3
/boot/config-2.6.23-gentoo-r3b
/boot/config-2.6.23-gentoo-r3a
/boot/.keep
/boot/grub
/boot/grub/vstafs_stage1_5
/boot/grub/stage2.old
/boot/grub/device.map
/boot/grub/stage1
/boot/grub/default
/boot/grub/fat_stage1_5
/boot/grub/jfs_stage1_5
/boot/grub/splash.xpm.gz
/boot/grub/grub.conf.sample
/boot/grub/reiserfs_stage1_5
/boot/grub/menu.lst
/boot/grub/stage2
/boot/grub/ufs2_stage1_5
/boot/grub/e2fs_stage1_5
/boot/grub/ffs_stage1_5
/boot/grub/stage2_eltorito
/boot/grub/xfs_stage1_5
/boot/grub/iso9660_stage1_5
/boot/grub/minix_stage1_5
/boot/grub/grub.conf
/boot/boot
/boot/config-2.6.24-gentoo-r4
/boot/config-2.6.24-gentoo-r3
|
The default file is not in the sda2 partition.
the grub.conf file differs a little since the sda2 refers to (hd0,1) and sdb1 refers to (hd0,0) |
|
Back to top |
|
|
nativemad Developer
Joined: 30 Aug 2004 Posts: 918 Location: Switzerland
|
Posted: Mon Apr 07, 2008 4:05 pm Post subject: |
|
|
eehhmm...
sdb1 should be hd(1,0) in grub....
Cheers |
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Mon Apr 07, 2008 5:58 pm Post subject: |
|
|
nativemad wrote: | eehhmm...
sdb1 should be hd(1,0) in grub....
Cheers |
But I thought it said sdb should be configured as hd(0,0) when sda is removed. |
|
Back to top |
|
|
nativemad Developer
Joined: 30 Aug 2004 Posts: 918 Location: Switzerland
|
Posted: Mon Apr 07, 2008 6:22 pm Post subject: |
|
|
When it is removed, yes! But when its attached while you're setting up grub (writing the mbr), its (hd1) [i thought that would be your problem! ].
Remember to adjust grubs config to reflect the sda/sdb change. Because if you remove your first disk, the other sata drive will catch the first avaiable device-file (sdb/hd1 will then be sda/hd0). |
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Mon Apr 07, 2008 6:37 pm Post subject: |
|
|
nativemad wrote: | When it is removed, yes! But when its attached while you're setting up grub (writing the mbr), its (hd1) [i thought that would be your problem! ].
Remember to adjust grubs config to reflect the sda/sdb change. Because if you remove your first disk, the other sata drive will catch the first avaiable device-file (sdb/hd1 will then be sda/hd0). |
Then I just dont get it. What is wrong with these instructions then?
http://gentoo-wiki.com/HOWTO_Install_on_Software_RAID#Installing_Grub_onto_both_MBRs |
|
Back to top |
|
|
nativemad Developer
Joined: 30 Aug 2004 Posts: 918 Location: Switzerland
|
Posted: Mon Apr 07, 2008 6:55 pm Post subject: |
|
|
Ahh, sorry! I haven't got it! (i was thinking about sun's sw-raid-boot hooks...)
But i've now seen, that you're using the second partition to boot (sdb2/md1). As the first one ist larger...
So then its clear!
Code: | grub> device (hd0) /dev/sdb
grub> root (hd0,1]) <-the second partition!
grub> setup (hd0) |
|
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Mon Apr 07, 2008 7:01 pm Post subject: |
|
|
nativemad wrote: | Ahh, sorry! I haven't got it! (i was thinking about sun's sw-raid-boot hooks...)
But i've now seen, that you're using the second partition to boot (sdb2/md1). As the first one ist larger...
So then its clear!
Code: | grub> device (hd0) /dev/sdb
grub> root (hd0,1]) <-the second partition!
grub> setup (hd0) |
|
Is that the code I should use? And if I then remove sda, it will boot? Then when I install grub on the original sda later on, should I use
device (hd0) /dev/sda
root(hd1,0)
setup (hd0)
then? |
|
Back to top |
|
|
nativemad Developer
Joined: 30 Aug 2004 Posts: 918 Location: Switzerland
|
Posted: Mon Apr 07, 2008 7:14 pm Post subject: |
|
|
The (hd0) refers to the raid... So yes, this was the code that should work. And its the same for the other disk, only exchange /dev/sdb with /dev/sda in the first line... but its still hd0 because of the mdraid.
Remember to setup the config like this:
Code: | root (hd0,1)
kernel /bzImage root=/dev/md0 <- if the larger part is the root partition!
|
|
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Tue Apr 08, 2008 7:01 am Post subject: |
|
|
nativemad wrote: | Ahh, sorry! I haven't got it! (i was thinking about sun's sw-raid-boot hooks...)
But i've now seen, that you're using the second partition to boot (sdb2/md1). As the first one ist larger...
So then its clear!
Code: | grub> device (hd0) /dev/sdb
grub> root (hd0,1]) <-the second partition!
grub> setup (hd0) |
|
I'm still confused but I tried what you wrote above.
device (hd0) /dev/sdb
root (hd0,X)
setup (hd0)
and got
Filesystem type is ext2fs, partition type 0xfd
(after the root command)
and got
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no
Error 2: Bad file or directory type
after the setup command.
The value of X, I tried both 1 and 0. Should it not be 0 since sdb1 is the partition I will boot from?
I really do not understand this grub thing... |
|
Back to top |
|
|
nativemad Developer
Joined: 30 Aug 2004 Posts: 918 Location: Switzerland
|
Posted: Tue Apr 08, 2008 7:36 am Post subject: |
|
|
Hmmm... strange!
Just to clear things up a bit:
"/dev/sdb2" aka "md1" aka "the second partition on your second drive" is your boot-partition? (the small one with the /boot directory inside)
"dev/sdb1" aka "md0" aka "the first partition on your second drive" is your root partition? (the large one with /etc /usr etc. in it)
Or do you have both root & boot in the same partition?
btw: it should also work, if you do it manually like there would be no raid at all.... (maybe you have to shutdown the raid-mirror and startup grub from a livecd or so to do this)
grub --no-floppy
root (hd1,1) <-sdb2 actually, if the above statements are right...
setup (hd1)
quit |
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Tue Apr 08, 2008 7:52 am Post subject: |
|
|
nativemad wrote: | Hmmm... strange!
Just to clear things up a bit:
"/dev/sdb2" aka "md1" aka "the second partition on your second drive" is your boot-partition? (the small one with the /boot directory inside)
"dev/sdb1" aka "md0" aka "the first partition on your second drive" is your root partition? (the large one with /etc /usr etc. in it)
Or do you have both root & boot in the same partition?
|
Oh, I'm sorry for not making this clear. Yes, sdb1 contains everything except /home. sdb2 is home directories
nativemad wrote: |
btw: it should also work, if you do it manually like there would be no raid at all.... (maybe you have to shutdown the raid-mirror and startup grub from a livecd or so to do this)
grub --no-floppy
root (hd1,1) <-sdb2 actually, if the above statements are right...
setup (hd1)
quit |
|
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Tue Apr 08, 2008 8:00 am Post subject: |
|
|
nativemad wrote: | Hmmm... strange!
grub --no-floppy
root (hd1,1) <-sdb2 actually, if the above statements are right...
setup (hd1)
quit |
Well with root (hd1,0) instead of hd1,1 (since sdb1 is root/boot, I get
Code: | Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd1)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no
Error 2: Bad file or directory type |
So I start to wonder... why cant if find the /boot directory? I really do not get it. |
|
Back to top |
|
|
nativemad Developer
Joined: 30 Aug 2004 Posts: 918 Location: Switzerland
|
Posted: Tue Apr 08, 2008 8:38 am Post subject: |
|
|
really strange...
What happens if you now do a:
grub> find /boot/grub/stage1
does hd(1,0) get listed?
maybe your /boot is a bit screwed up?!? I would try to remerge grub then...
Or is there perhaps something strange inside of /boot/grub/device.map? |
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Tue Apr 08, 2008 8:48 am Post subject: |
|
|
nativemad wrote: | really strange...
What happens if you now do a:
grub> find /boot/grub/stage1
does hd(1,0) get listed?
maybe your /boot is a bit screwed up?!? I would try to remerge grub then...
Or is there perhaps something strange inside of /boot/grub/device.map? |
it only lists (hd0,1)
I have remerged grub. but I could try it again perhaps with an emerge -C also.
/boot was initialy created by a rsync process from sda2.
Code: | # cat /boot/grub/device.map
(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb |
|
|
Back to top |
|
|
nativemad Developer
Joined: 30 Aug 2004 Posts: 918 Location: Switzerland
|
Posted: Tue Apr 08, 2008 11:35 am Post subject: |
|
|
As i am now a bit clueless, i would try another trick (known from strange compaq-raid adapters).
Code: | root (hd1,0)
setup --stage2=/boot/grub/stage2 (hd1)
|
Good luck! |
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Tue Apr 08, 2008 12:18 pm Post subject: |
|
|
Unfortunatly, it didn't work.
Code: | root (hd1,0)
Filesystem type is ext2fs, partition type 0xfd
grub> setup --stage2=/boot/grub/stage2 (hd1)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no
Error 2: Bad file or directory type
|
|
|
Back to top |
|
|
nativemad Developer
Joined: 30 Aug 2004 Posts: 918 Location: Switzerland
|
Posted: Tue Apr 08, 2008 12:48 pm Post subject: |
|
|
maybe a bit of a kamikaze action...
does this work?
grub-install /dev/sdb
or create a new device-map with just
(hd0) /dev/sdb
as content, and try to write the mbr with (hd0,0)
as last resort, rename /boot, mkdir /boot; emerge grub; copy kernel,initrd and grub.conf in the new dir and finally try to write that stupid mbr! |
|
Back to top |
|
|
oldefortran l33t
Joined: 28 Feb 2004 Posts: 652
|
Posted: Tue Apr 08, 2008 2:10 pm Post subject: |
|
|
nativemad wrote: | maybe a bit of a kamikaze action...
does this work?
grub-install /dev/sdb
|
# grub-install /dev/sdb
/dev/md/0 does not have any corresponding BIOS drive.
nativemad wrote: |
or create a new device-map with just
(hd0) /dev/sdb
as content, and try to write the mbr with (hd0,0)
|
write mbr is done with the setup command?
nativemad wrote: |
as last resort, rename /boot, mkdir /boot; emerge grub; copy kernel,initrd and grub.conf in the new dir and finally try to write that stupid mbr! |
Can it be there is a problem with mbr? |
|
Back to top |
|
|
|