Results 1 to 10 of 24

Thread: [SOLVED] How to determine which Linux partition w/ Grub controls the MBR?

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Question [SOLVED] How to determine which Linux partition w/ Grub controls the MBR?

    If in addition to Ubuntu I have other linux distros installed in separate partitions on my HD, what is a good way to determine exactly which distro (partition) is controlling the MBR? I know I can figure it out by examining the menu.lst files for all the partitions, but is there some Grub command in the grub CLI that will just tell me what partition controls the MBR?

    Thanks for any help.

  2. #2
    Join Date
    Mar 2008
    Location
    NSW Australia
    Beans
    233
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: How to determine which Linux partition w/ Grub controls the MBR?

    ubuntuforums.org/showthread.php?t=224351

    Best grub tutorial ever. I think the command you're looking for is

    Code:
    sudo grub
    find /boot/grub/stage1
    Good luck.

  3. #3
    Join Date
    Jun 2006
    Location
    Texas
    Beans
    3,931
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to determine which Linux partition w/ Grub controls the MBR?

    Not anyway I know of to tell which Linux installs GRUB controls
    the MBR. (other that the one you mentioned about checking the menu.lst).

    If you have always used the default install then I'd bet the GRUB you get belongs to the last distro you installed.

    Most Linux installers let you put the GRUB stage1 code in the boot sector of its install partition. thats what I do. then I just add a configfile or chainloader option to my 1st GRUBS menu.lst to boot the other Linux distro.

    Cood stuff here on GRUB IDBS GRUB Page

    Good to know stuff here too GrubHowto - Community Ubuntu Documentation
    UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. -- Doug Gwyn
    SystemRescueCd | Dual Boot | psychocats | FAQ

  4. #4
    Join Date
    Apr 2008
    Beans
    3,317
    Distro
    Kubuntu 9.10 Karmic Koala

    Re: How to determine which Linux partition w/ Grub controls the MBR?

    I don't really recommend this (since "dd" is one of those dangerous commands and you have to be really careful whenever you use "dd"), but this will tell you which linux is in control of the MBR

    Code:
    sudo dd if=/dev/sda  bs=1 skip=1049 count=2 | hexdump
    (Here you need to replace /dev/sda by whatever drive you are booting from. Also this is a command in a linux terminal, not in the grub command line))

    The output will look like this


    00000000 ff05
    00000002

    or

    00000000 8205
    00000002

    In the first case the controlling linux is (hd0,5)
    ff means the controlling linux is on the boot drive, "ff 0n" means (hd0,n).

    In the second case the controlling linux is (hd2,5) "8m 0n" means (hdm,n)
    Last edited by meierfra.; September 4th, 2008 at 07:25 PM. Reason: fixed a mistake

  5. #5
    Join Date
    Jun 2006
    Location
    Texas
    Beans
    3,931
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to determine which Linux partition w/ Grub controls the MBR?

    Quote Originally Posted by meierfra. View Post
    I don't really recommend this...
    Nice. Do you remember where you found this little nugget.?
    UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. -- Doug Gwyn
    SystemRescueCd | Dual Boot | psychocats | FAQ

  6. #6
    Join Date
    Apr 2008
    Location
    Southern California, USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: How to determine which Linux partition w/ Grub controls the MBR?

    Quote Originally Posted by louieb View Post
    Nice. Do you remember where you found this little nugget.?
    Here is a good explanation of how Grub works on the machine level. It describes in detail how Grub works. It displays the hex of the MBR.

    So this might be what your looking for:

    http://mirror.href.com/thestarman/asm/mbr/GRUB.htm
    boot_info_script | AMD64 Athlon X2 Dual-Core - nVidia Geforce 6150 SE - 4GB DDR3

  7. #7
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: How to determine which Linux partition w/ Grub controls the MBR?

    Quote Originally Posted by meierfra. View Post
    Code:
    sudo dd if=/dev/sda  bs=1 skip=1049 count=2 | hexdump
    I agree with louieb, where did you find this extremely useful gem of pure Linux voodoo? Do you know the translation behind the number for the HD? If "ff" is the first HD, "52" the second, what would be the third or fourth for instance?

    Although I wish grub had some command to simply tell which partition the MBR points to, this command gets the job done. Thanks much for sharing it!
    Last edited by caljohnsmith; June 23rd, 2008 at 03:24 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •