FedoraForum.org - Fedora Support Forums and Community
Page 1 of 3 1 2 3 LastLast
Results 1 to 15 of 36
  1. #1
    Join Date
    Dec 2004
    Location
    Canada
    Age
    26
    Posts
    9,224

    The multi-OS, multi-boot GRUB guide (Windows included!)

    Hello,

    GRUB, short for GRand Unified Bootloader, is one of the best boot loaders I have ever encountered. Not only can it handle many kernels at once, but many distro's kernels, too!
    One of the best features of all is that GRUB can "chainload" - pass control to other bootloaders - so if one OS isn't supported by grub (*cough* Windows *cough* ), you can use GRUB to pass over control to NTLDR (the Windows bootloader) and Naitively boot Windows from there.

    GRUB configuration file

    The secret to all this is the GRUB configuration file. It's always located at /boot/grub/grub.conf, but for your convince a symbolic link of that file is located at /etc/grub.conf (less typing by a few characters... )

    To take a look at or edit or your configuration, simply type:
    Code:
    su -
    gedit /etc/grub.conf
    If you don't like gedit, replace it for your favorite editor

    GRUB & drive naming schemes.
    Something one must keep in mind when dealing with GRUB is that it's naming scheme for drives is different. When running grub-install, the command to install GRUB onto a drive, a device map is generated located in /boot/grub/device.map. This file maps the GRUB drive names to their respective /dev paths in a format like this:
    Code:
    (hd#) /dev/hdx
    the "#" starts at 0 and moves up by 1 for each drive added.

    So for example if I had two hardrives, one IDE and one SATA their paths would be /dev/hda and /dev/sda respectively. So my file should look like:
    Code:
    (hd0) /dev/hda
    (hd1) /dev/sda
    Once the map is set up correctly, using (hd0) in GRUB is just like accessing the /dev node specified in the map file. To access individual partitions, add a comma followed by the partition number after the hard drive number:
    Code:
    (hd0,0)
    Again, partition numbers start at 0. So using the same situation, (hd0,1) is like /dev/hda1 while (hd1,5) is like /dev/sda6.

    Note that (hd#) entries don't actually have to be "real" hard drives - One could map /dev/fd0, the floppy node, to (hd2) for example or a CDROM to (hd3).

    To edit the device map, run:
    Code:
    su -
    gedit /boot/grub/device.map
    Once you've done editing, you must commit changes to the map by re-installing GRUB
    This will not erase your grub.conf
    Code:
    grub-install /dev/hdx
    Where /dev/hdx is your root drive.

    GRUB commands
    • root : Set the root to selected partition or disk.
      Usually used in a format like this:
      Code:
      root (hd#,#)
      Note that plain (hd#) can be used to root into a whole disk - Useful for chainloading a MBR.
    • rootnoverify : Same as root but don't try to verify the partition. Useful for root'ing into NTFS drives to chainload them.
    • title : Start a menu title. Commands under it will be executed when selecting it from the GRUB menu at boot time. A name should specified after the title command.
      Usually used in a format like this:
      Code:
      title My Name Here
    • kernel : Use the provided kernel image (vmlinuz*) to boot. Any other arguments are passed to the kernel.
      Usually used in a format like this:
      Code:
      kernel /vmlinuz-[version] root=/dev/hdx# option1 option2
      One must set root= to their root path, or use LABEL=[root-partition-label].
    • initrd : Use the provided ramdisk image (initrd*.img)
      Usually used in a format like this:
      Code:
      initrd /initrd-[version].img
    • chainloader +1 : This command will take the boot sector of the root and use it to boot. If the root in a whole disk, then it will load the MBR.


    Examples
    If /dev/hda1 is my Windows partition, and I've mapped /dev/hda to (hd0) in my device map like this:
    Code:
    (hd0) /dev/hda
    This would pass control to NTLDR letting me boot Windows XP:
    Code:
    title Windows XP
         rootnoverify(hd0,0)
         chainloader +1
    Use the same idea if you want to chainload to the MBR of a slave disk (assuming the slave is mapped to (hd1):
    Code:
    title Slave Disk
         rootnoverify(hd1)
         chainloader +1
    Booting a custom kernel where the root partition's label is "/", passing 'quiet' and 'rhgb' as boot arguments:
    Code:
    title Fedora Core (2.6.19.2-custom)
            root (hd0,0)
            kernel /boot/vmlinuz-2.6.19.2 ro root=LABEL=/ rhgb quiet
            initrd /boot/initrd-2.6.19.2.img
    Firewing1
    Last edited by Firewing1; 13th July 2009 at 11:09 PM.
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  2. #2
    Join Date
    Dec 2004
    Location
    Canada
    Age
    26
    Posts
    9,224
    This may grow to over 10,000 characters so I'm posting this to reserve the second post for later editing
    Last edited by Firewing1; 13th July 2009 at 11:09 PM.
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  3. #3
    Join Date
    Sep 2005
    Posts
    13
    Hi Firewing1,

    Just started a similar thread in General Support, and was pointed in your direction.

    Being fairly new to linux, i am still in the stages of needing to be in windows, but have setup my workplace laptop to dual boot to FC6 and Windows XP.

    I want to be able to restart Windows and boot to FC6, but grub menu has Windows selected as the default OS.

    I work from home 3 days a week and connect to my laptop using vpn and remote desktop. I want to be able to restart windows but choose FC6 as the OS.

    Looked around for various windows 'restart' software, but none that quite do what i want.

    I know how to change the boot order when in FC6, but dont want to set FC6 as default OS.

    Can anyone help?

    cheers
    Earlyspider

  4. #4
    Join Date
    Nov 2005
    Location
    Los Angeles area
    Posts
    887
    Can you explain the chainloader more? If my WinXP directive says
    rootnoverify (hd0,0)
    chainloader +1
    where is the next stage to be executed to be stored? Is this in the
    MBR + "DOS-compat" region (first cylinder) or in the first partition?

    That is, does installation of GRUB move the original MBR to the second
    sector of the first cylinder or something else?

  5. #5
    Join Date
    Dec 2004
    Location
    Canada
    Age
    26
    Posts
    9,224
    Quote Originally Posted by earlyspider
    Hi Firewing1,

    Just started a similar thread in General Support, and was pointed in your direction.

    Being fairly new to linux, i am still in the stages of needing to be in windows, but have setup my workplace laptop to dual boot to FC6 and Windows XP.

    I want to be able to restart Windows and boot to FC6, but grub menu has Windows selected as the default OS.

    I work from home 3 days a week and connect to my laptop using vpn and remote desktop. I want to be able to restart windows but choose FC6 as the OS.

    Looked around for various windows 'restart' software, but none that quite do what i want.

    I know how to change the boot order when in FC6, but dont want to set FC6 as default OS.

    Can anyone help?

    cheers
    Earlyspider
    In your config file, there's a 'default' command. default=0 means the default boot is the first Title entry, default=1 is the second, etc... Just change that to the most recent Fedora title.

    As for chainloader, it doesn't move your GRUB installation but just reads the boot sector or MBR of the root partition and boots that instead. That's why we chainload when the root is (hd0,0) - It effectively tells GRUB to take a look at the boot sector of the NTFS partition, ignoring that it can't read any actual contents of the NTFS partition. The boot sector has NTLDR, so GRUB passes control over to it and not NTLDR has control of the boot process.
    Firewing1
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  6. #6
    Join Date
    Nov 2005
    Location
    Los Angeles area
    Posts
    887
    Quote Originally Posted by Firewing1
    As for chainloader, it doesn't move your GRUB installation but just reads the boot sector or MBR of the root partition and boots that instead. That's why we chainload when the root is (hd0,0) - It effectively tells GRUB to take a look at the boot sector of the NTFS partition, ignoring that it can't read any actual contents of the NTFS partition. The boot sector has NTLDR, so GRUB passes control over to it and not NTLDR has control of the boot process.
    Firewing1
    Where is the partition specified? What if I have two WinXP installations on the disk?

  7. #7
    Join Date
    Dec 2006
    Location
    Fort Collins, Colorado
    Posts
    11

    Question Multi-Boot Woes Need Your Help Please

    Hi to All
    First of all, thank you very much Firewing1, for taking the time to explain the process of mapping, setting up the config file and re-installing Grub to find the changes . I have read the forums for the last two months and I am extremely confused. Here's why...

    I am fairly new to Fedora Linux Core 6 (I Love it) The complete install works perfect.
    I am however, stuck because I don't know how to put together the code I need to multi-boot my personal configuration.

    Please allow me to explain my systems hard drives (3 of them) and how I have them connected. Then allow me to explain how I prefer them to show up in the Grub boot loader.

    Before I get to the drives, I have two Grub loaders installed. The first grub v1.5 was installed when I installed Suse 10.0 onto my existing Windows 2000 Professional Drive. (NTFS) file system. The second Grub v2.0 was installed when I installed Fedora Core 6 onto Drive number 3. (Which is a Stand alone Drive.) Grub 1.5 recognized the windows 2000 partion right away and also my 2nd Drive (windows data ) but not my Fedora Drive (drive #3). I want to be able to go to one boot screen and be able to select any one of the three Operating Systems.

    So, I have 3 IDE Hard Drives
    Primary Master, first partition: is Windows 2000 Professional.
    I assume this will be (hd0,0) /dev/hda
    Primary Master, second partition: is Suse 10.0
    I assume this will be (hd0,1) /dev/hda
    Secondary Master, Only 1 Partition: is My Windows Data (NTFS)
    I assume this will be (hd1) /dev/hda
    Lastly, Secondary Slave is: Fedora Core 6
    I assume this will be (hd2) /dev/hda.

    Can you please help me code this.. I am confused. Must I install Grub onto the MBR of my first drive where windows 2000 is residing, (hd0,0)? After I do this, How do I get my Suse 10 to be recognized?

    Do I need to edit two files? One for the mapping, and one for the config after I install Grub to the MBR? or will that be sufficient.

    I am trying to get a grip on the chainloader statement. (Do I need it, Where does this belong?)

    You can't Imagine how much I appreciate everyone's help in getting me resolved on this... I also hope anyone else going through this with me will be helped by this request...

    Thanks so much for your help..
    Last edited by Muneco; 11th February 2007 at 04:25 AM. Reason: Would like community Manager to respond

  8. #8
    Join Date
    Aug 2006
    Location
    Sudbury, MA, USA
    Age
    29
    Posts
    404
    Firewing1,

    i think you have a typo in your first post.

    Code:
    (hd0) /dev/hda
    (hd1) /dev/hda
    should be

    Code:
    (hd0) /dev/hda
    (hd1) /dev/sda

  9. #9
    Join Date
    Nov 2005
    Location
    Los Angeles area
    Posts
    887
    Can you show your grub.conf (menu.lst) files? I think you should be able to
    copy a line from your grub.conf file to the menu.lst file, provided the disk numbering
    is consistent.

  10. #10
    Join Date
    Feb 2007
    Posts
    11
    Hi,
    I have just installed FC6 on my single hard drive in a seperate partion. Other main partion has Windows XP. I have NOT installed GRUB on Mbr. Instead used the boot area of FC6 install.
    (This is my first Linux install = newbie)

    I am planning to boot FC6 from rescue CD manually. (Since a boot diskette is not possible) Becasue I dont want to trouble my MBR. I tried the following,
    Boot with Rescue CD. Go to the prompt.
    then run GRUB.
    At this point HOW can I boot FC6?

    Or, is there any other method to boot FC6 installed at the hard drive, manually. ??

    Tnx, ahead.

  11. #11
    Join Date
    Feb 2007
    Posts
    11
    I have loaded the Grub.conf file at grub prompt with;
    configfile /grub/grub.conf
    It worked and displayed the boot menu, where can i choose 2 os to boot from.
    When I choose Fedora boot stops at initrd command giving,
    Error16: Inconsistent filesystem structure...
    and booting stops..

    Please help. I am totally lost at this stage.

  12. #12
    Join Date
    Feb 2007
    Location
    Alabama
    Age
    30
    Posts
    51

    Question Total N00b

    Hi ALL,
    I am a complete N00B at Linux/using GRUB. I know what each is, and somewhat how they work, I just don't know how to get them to do what I want.

    I have 2 Drives
    SATA Windows 1 partitioin
    IDE FC6 1 partition

    I am still trying to ween myself off of Windows, but there are still a few things in the aspect of games that are keeping me tied down, so I want Windows to be the first boot. How do I do this?

    Please spare no expense, be as descriptive and specific as you possibly can, I can BARELY use the terminal, and thats only from a long lost memory of DOS

    All help is and will be greatly appreciated
    Thank you guys so much!

  13. #13
    Join Date
    Aug 2006
    Location
    Sudbury, MA, USA
    Age
    29
    Posts
    404
    Quote Originally Posted by HalJordan
    Hi ALL,
    I am a complete N00B at Linux/using GRUB. I know what each is, and somewhat how they work, I just don't know how to get them to do what I want.

    I have 2 Drives
    SATA Windows 1 partitioin
    IDE FC6 1 partition

    I am still trying to ween myself off of Windows, but there are still a few things in the aspect of games that are keeping me tied down, so I want Windows to be the first boot. How do I do this?

    Please spare no expense, be as descriptive and specific as you possibly can, I can BARELY use the terminal, and thats only from a long lost memory of DOS

    All help is and will be greatly appreciated
    Thank you guys so much!
    so to clarify, you have two hard drives, one is a SATA drive with Windows, and the other is an IDE drive with fedora?

    first you need to set up your bios so it boots from the fedora IDE drive, if it isnt already doing that. you may need to edit the bios. then, you need to edit the file /etc/grub.conf. you need to be root to edit the file. the easiest way to do so is open a terminal, and type in:

    Code:
    su -
    #enter your password
    gedit /etc/grub.conf
    you should see a number of commented lines, default and timeout lines, and then one or two lines that will boot fedora, such as:

    Code:
    title Fedora Core (2.6.19-1.2895.fc6)
    	root (hd0,0)
    	kernel /boot/vmlinuz-2.6.19-1.2895.fc6 ro root=/dev/sda1 rhgb quiet
    	initrd /boot/initrd-2.6.19-1.2895.fc6.img
    if grub cannot currently boot windows, you need to add the following lines to the bottom of the file:

    Code:
    title Windows
    	map (hd0) (hd1)
    	map (hd1) (hd0)
    	rootnoverify (hd1,1)
    	chainloader +1
    	makeactive
    	boot
    you should edit the file default=n, and change n to whichever operating system you want to boot first. n=0 is the first operating system, n=1 is the second, etc.
    you can also edit the timeout line, which will specify how long grub will wait for you to select an operating system before booting into the default.
    Last edited by slade17; 19th February 2007 at 08:24 PM.

  14. #14
    Join Date
    Feb 2007
    Location
    Alabama
    Age
    30
    Posts
    51
    Ok, so all I have to do is edit the file and save it. I don't have to run any other special commands?

  15. #15
    Join Date
    Feb 2007
    Location
    Alabama
    Age
    30
    Posts
    51
    Sorry, I tried both ways
    the default that showed up before you posted that thread hangs up when it displays the
    rootnoverify ...
    chainloader 1+

    and then your way threw an error

    give me what specific system specs you need, with my history there's something I need to tell you guys that I don't know about, its something small, insignificant, and stupid, but its the only thing holding me back and it does a wonderful job at that

    I know my way around the hardware, and I know how Linux works, I just need more practice at getting what i want out of it

Page 1 of 3 1 2 3 LastLast

Similar Threads

  1. GRUB woes with FC9 - Multi-boot system!
    By bulava in forum Installation, Upgrades and Live Media
    Replies: 19
    Last Post: 4th December 2008, 03:57 PM
  2. Guide: Multi-Booting Fedora & Windows without GRUB
    By CraigWatson in forum Guides & Solutions (Not For Questions)
    Replies: 0
    Last Post: 4th February 2008, 09:08 PM
  3. GRUB Multi boot FC5 & FC6
    By cplutis in forum EOL (End Of Life) Versions
    Replies: 13
    Last Post: 24th January 2007, 10:48 AM
  4. grub multi boot
    By terry_g in forum Installation, Upgrades and Live Media
    Replies: 0
    Last Post: 1st October 2006, 04:00 PM

Tags for this Thread

Posting Permissions

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