Thread: grub(boot loader) programming

  1. #1
    Registered User
    Join Date
    Aug 2012
    Location
    Delhi,India
    Posts
    4

    grub(boot loader) programming

    Actually i need to construct a server with two hard disks
    condition:

    condition:

    if(hd1 is crashed)
    search for blank hard-disk
    make grub entry as hd(0,1)

    can any one assist me the way.

    --
    Thanks in advance

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If the first disk is trashed, where do you think grub will load from (not from the crashed hard disk).

    You can set the BIOS boot order to try each hard disk in turn (until it finds a bootable disk), but that's about it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Aug 2012
    Location
    Delhi,India
    Posts
    4
    Sir,
    please look at the structure

    BIOS---->GRUB---->Loades OS

    idea is like this.
    As one Hard Disc fails,it reboots..even after crash at least grub part remains with it

    So,i am finding the mechanism that grub part of Crashed hard disc to be changed by some mechanism
    and second Hard Disc will come into priority and starts booting.

    so can you assist me a way??

  4. #4
    Registered User
    Join Date
    Aug 2012
    Location
    Delhi,India
    Posts
    4
    Making it more understanding..
    i want to edit my /boot/grub/grub.conf or /etc/grub.conf file.
    but through some programming mechanism.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If the hard disk has completely failed, then you're not going to be loading grub to begin with.

    If the OS somehow managed to trash it's own partition (say corrupted a few files - say malware), then there isn't going to be a reliable test you can do to establish beforehand whether a particular disk image is actually bootable or not. All the necessary files may be there, but it could still lock up somewhere in the boot process.

    Have you actually looked at the source code yet?

    Somewhere (I'm guessing), a data structure will be created from a grub.conf file.

    What you need to do is iterate through that data structure to find each bootable partition/image and perform whatever "validation" tests you feel are necessary. If the test fails, then you delete that entry from the data structure.

    You present to the user what is left after you have done this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Aug 2012
    Location
    Delhi,India
    Posts
    4
    Actually i want to edit "grub.conf" like this,




    default=1
    timeout=8


    title Fedora(2.6)
    root (hd0,0)
    kernel /vmlin ro root=UUID=xxxx-xxxxx-xxxx-xxxx-xxxxx rhgb quiet
    initrd /initrd-2.6
    title Susee(2.8)
    root (hd1,0)
    kernel /vmlin ro root=UUID=yyyyyy-yyyyyy-yyyyy-yyyyy-yyyy rhgb quiet
    initrd /initrd-2.8


    Is it possible..
    please add your comments

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GRUB from windows
    By underline_bruce in forum Linux Programming
    Replies: 2
    Last Post: 07-08-2008, 05:34 AM
  2. like grub or lilo
    By enjoy in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 10-24-2007, 10:43 AM
  3. Contract work. Boot loader.
    By Kennedy in forum Projects and Job Recruitment
    Replies: 4
    Last Post: 12-05-2006, 03:48 AM
  4. Grub
    By Wraithan in forum Tech Board
    Replies: 4
    Last Post: 07-27-2006, 05:21 PM
  5. getting rid of grub
    By axon in forum Tech Board
    Replies: 3
    Last Post: 03-17-2004, 07:15 PM

Tags for this Thread