MBR booting from wrong partition

I never got around to fixing this, I’m just using a plop boot cd…it does what I need, boot from hdc 2.
or (hd2,1)
I’m having an issue, because Im not sure how to change the mbr so when I boot the computer from the third hdd, it just works…where is the MBR, and how do I edit it, or better, is there a GUI interface I can use?

Any and all help will be appreciated.

Thank you.

The MBR stands for Master Boot Record and there is only one per Hard Disk. There are three basic MBR conditions:

  1. It is blank, such as a brand new drive:
  2. It is set to boot the Active Primary Hard Disk Partition 1, 2, 3 or 4 (Different versions of the MBR exist for each Windows version, but they all do the same thing)
  3. You can load the Grub Boot Loader into it. Why would you do this? So that you can “boot” a copy of Linux/openSUSE from any partition, including Extendten/Logical ones (Partitions 5 and up).

There is a script file called findgrub that you can run that will identify all Hard disks and their boot records here:

Looking for Grub and Windows bootloader in all partitions.

Message #69 contains the most recent version of findgrub for you to use. Further, I would post its results here for us to see along with your menu.lst file and device.map files. Open a terminal session and enter the following commands:

cat /boot/grub/menu.lst
cat /boot/grub/device.map
su -
password:
fdisk -l

Post the results for us to see. If you can’t run this stuff, then we will need a lot more information about your computer/Linux setup than what you posted this time to be able to help.

Thank You,

**well…using the script didn’t work…

Here is menu.lst. Note:
I did edit some things out of this, I did this because I was tired of seeing 10 different options to boot from.

# Modified by YaST2. Last modification on Wed Feb  9 19:13:52 PST 2011
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader
**
default 0
timeout 8
gfxmenu (hd0,1)/boot/message
##YaST - generic_mbr
##YaST - activate

#    initrd /boot/initrd-2.6.34.7-0.7-pae
###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.3 - 2.6.34.7-0.7
    kernel (hd0,1)/boot/vmlinuz-2.6.34.7-0.7-desktop nohz=off
    initrd (hd0,1)/boot/initrd-2.6.34.7-0.7-desktop
**
###Don't change this comment - YaST2 identifier: Original name: linux###
#title openSUSE 11.3 - 2.6.34.7-0.7 (default)
#    root (hd0,1)
#    kernel /boot/vmlinuz-2.6.34.7-0.7-default root=/dev/disk/by-id/ata-WDC_WD800JD-00LSA0_WD-WCAM99348341-part2 
    resume =/dev/disk/by-id/ata-WDC_WD800JD-00LSA0_WD-WCAM99348341-part1 splash=silent quiet showopts vga=0x345
#    initrd /boot/initrd-2.6.34.7-0.7-default
###Don't change this comment - YaST2 identifier: Original name: failsafe###
#title Failsafe -- openSUSE 11.3 - 2.6.34.7-0.7 (default)
#    root (hd0,1)
#    kernel /boot/vmlinuz-2.6.34.7-0.7-default root=/dev/disk/by-id/ata-WDC_WD800JD-00LSA0_WD-WCAM99348341-part2 
    showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x345

#    initrd /boot/initrd-2.6.34.7-0.7-default
**
###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.3 - 2.6.34.7-0.7
    kernel (hd0,1)/boot/vmlinuz-2.6.34.7-0.7-desktop root=/dev/disk/by-id/ata-WDC_WD800JD-00LSA0_WD-WCAM99348341-part2
    showopts
    apm =off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x345
    initrd (hd0,1)/boot/initrd-2.6.34.7-0.7-desktop

###Don't change this comment - YaST2 identifier: Original name: windows###
title Windows 7
    rootnoverify (hd0,0)
    chainloader +1

###Don't change this comment - YaST2 identifier: Original name: hard_disk###
title Hard Disk
    rootnoverify (hd0,4)
    chainloader +1**

And the device.map is here.


(hd0)	/dev/disk/by-id/ata-WDC_WD800JD-00LSA0_WD-WCAM99348341
(hd2)	/dev/disk/by-id/ata-ST3400832AS_5NF27PG5
(hd1)	/dev/disk/by-id/ata-Maxtor_6Y080M0_Y24K6FXC

and the fdisk -l



Disk /dev/sdb: 82.0 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7ac66ffa

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/sda: 400.1 GB, 400088457216 bytes
255 heads, 63 sectors/track, 48641 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe8cde360

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       48642   390709248    7  HPFS/NTFS

Disk /dev/sdc: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7f037f03

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         262     2103296   82  Linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sdc2             262        2873    20972544   83  Linux
/dev/sdc3            2873        9730    55073792   83  Linux

Thanks again, Look forward to hearing from you soon!**

Did you set the script to executable?

You have no partitions on the sdb device???

Yeah, I think my sdb hdd is broke, I can’t seem to add a partition to it :
always says it is busy…even in windows…cant format, nothin.

ok, i did something wrong, figured it out, gimme a second to append it to a file and post here
can’t append I guess…So i’ll type it out verbatim.


 - reading MBR on disk /dev/sdb       ...
 - reading MBR on disk /dev/sda       ...
 - searching partition /dev/sda1   (NTFS)      ...   --> Windows 7/Vista Loader
  found in /dev/sda1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

###Don't change comment - YaST2 ID: orig name:  WindowsBootLoader###
title Windows on /dev/sda1
rootnoverify (hd2,0)
chainloader +1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-reading MBR on disk /dev/sdc                 ...
 - skipping partition /dev/sdc1  (swap
 - reading bootsector /dev/sdc2 (LINUX)    ...  -->Grub found in /dev/sdc2
 - reading bootsector /dev/sdc3 (LINUX)      ...

You need to make it executable.

Copy and paste this text into a text file and save it in your home area, bin folder (~/bin) as the file findgrub

Once the file is saved, you must make the file executable using the terminal command: chmod +u ~/bin/findgrub

I got it, below, thx :slight_smile:

anyone?

thx.

So, to boot from /dev/sdc2, shown below you need:

- reading bootsector /dev/sdc2 (LINUX)    ...  -->Grub found in /dev/sdc2
  1. /dev/sdc needs to be setup as the boot drive in your BIOS - Don’t know if you have done that.
  2. Standard Booting MBR on sdc - Do not know if this is true
  3. sdc2 needs to be marked active for booting, BUT IT IS NOT Active!
  4. Grub Needs to be loaded into sdc2, which it is.

You can check your BIOS setup to make sdc the boot drive. You can use a LiveCD with GPARTED (Like Gnome) and mark sdc2 as Active for booting. You are given an opportunity to load a generic booting MBR when you install openSUSE, but only Windows programs seem to allow you to do this later. However, findgrub does confirm that grub is installed into sdc2 as required.

Thank You,

#1 is true, I boot from sdc and it boots from partition 1 like…it should I guess.
#2 is perhaps false, how would I check this?
#3 yes, is true, dunno how to change this to active.
#4 yep…

is there a way to use GPARTED for the actual installed version? I mean I can dig out the orig live dvd and do it…but it’d be nice.

Thanks in advance!

gparted is on PartedMagic CD (a mini Linux Live system mostly for the purpose of partitioning) and on Ubuntu Live CD. But you don’t need gparted to set the bootflag on a partition. You can do it as root with fdisk:

in a terminal, type:

**su -l**
**fdisk /dev/sdc**
Command (m dor help):** a**
Partition number (1-13): **2**
Command (m dor help):** w**

That’s it.

do not know for #2 but for #3 in Gparted you can right click on sdc2 / Manage Flags / Tick-Select “boot”.

Same thing can be done with fdisk -edit] seems you got info on it while I was answering.

Cheers and good luck.

ok, i tried the whole


su -l
fdisk /dev/sdc
Command (m dor help): a
Partition number (1-13): 2
Command (m dor help): w

thing, but it still did not work…
when I do fdisk -l, /dev/sda1 still has a * next to it indicating that it set as the boot drive…

stupid timed edit post timing things…
sorry for the double post.

Upon trying again I got an error.


WARNING:  Re-reading the partition table faioled with error 16: Device or resource busy.  The kernel still uses the old table.  The new table will be used at the next reboot or after you run part probe (8) or kpartx(8).
Syncing disks.

soo…hope that helps?

This is not related. sda1 is the active partition of disk sda. sdc2 shoud now be the active partition of disk sdc. That’s what the star indicates. In the absence of a boot manager in the MBR of the first HD, the active partition of the first HD will be booted. If you install a decent bootmanager (like grub) in the MBR of your first HD, you can boot (almost) anything from any partition on any HD (if your BIOS doesn’t mind).

If it’s called WARNING, it is not fatal. This message is normal and harmless.

I still restarted the computer to no avail, maybe something is wrong with the MBR on sdc?
Is it possible to rewrite GRUB + MBR so we can start off fresh, only thing that may be a problem then would be the W7 OS which I only need for compatibility issues.

under hwinfo --partition
I find that under sdc2 active=unknown.
it says that for all though…relative?
meh.

Here is a link on how to reinstall the Grub Boot Loader:

Re-Install Grub Quickly with Parted Magic

Thank You,

i tried at least 3 different methods including that link you gave to me. None of them worked. It seems taht i couldn’t use the iso included in that post, so i had to download the latest one which i guess does not have RoxTerm which i needed, so surprise surprise when I type in ‘grub’ it doesn’t find the command. so now im at a bit of a cross roads…im open to using the bootloader from windows 7, and have tried using easybcd to do this…and for some reason, when i mess with this stuff, the hard drive that has linux changes from hd1,1 to hd2,1…it keeps jumping around, and has been doing this for a while, i can’t even begin to figure this out…

this is giving me such a headache, thanks guys for helping me through.

Does the following quote form ArchLinux Wiki help you better understand?

udev loads kernel modules by utilizing coding parallelism to provide a potential performance advantage versus loading these modules serially. The modules are therefore loaded asynchronously. The inherent disadvantage of this method is that udev does not always load modules in the same order on each boot. If the machine has multiple block devices, this may manifest itself in the form of device nodes changing designations randomly. For example, if the machine has two hard drives, /dev/sda may randomly become /dev/sdb.

This is not uncommon that device names change as described above, in particular when you mix SATA and IDE drives. I also had the case where from time to time an external USB drive became sda. The only thing you can do is avoid using device by names in configuration files like /etc/fstab and /boot/grub/menu.lst and reinstall Grub with an adequate device.map. In case you’re mixing IDE and SATA hds together, you could spare yourself some headaches by getting rid of the IDE ones.