System Administration
Showing results for 
Search instead for 
Did you mean: 

Re: GRUB - Need command to install BOOTSTRAP

Go to solution
Valued Contributor

GRUB - Need command to install BOOTSTRAP

Hello Everyone;


I just installed Fedora 16 (which is only SLIGHTLY less disgusting to work with than Unbuntu). Talk about a bloated O/S! Single-user has more processes running than my RHE-3.4 does when in INIT 5. It should be called: Linux - the U.S. Airport Security Version!


I've run Linux since the early 90's thru RHE 2003 and they were pretty-much all the same but the new utilities are quite different and I'm having a battle getting a hold on them.


[So, Tony - tell us how you REALLY feel about the new Linux?]  :-)




I have a 2 master drives in the host. One has a full version of F-16, the other only the necessary files/utilities to get it up and running.


The bootstrap is only on one drive. I want to copy it to the other drive so I can select either one and boot from it.


I've been all over the GRUB manual and I can't find an example of the command line I need to do that.


I have the /boot/grub2/grub.cfg file but don't know how to invoke GRUB to read it and then write it to disk.


Would someone be so kind as to give me an example of how to do that.


If someone could recommend a book that will take me thru an IN-DEPTH education of F-16, that would be great!



tony j. podrasky

REMEMBER: Once you eliminate your #1 problem, #2 gets a promotion.
Honored Contributor

Re: GRUB - Need command to install BOOTSTRAP

With modern hardware, I must ask: are you using traditional PC boot sequence, or the new-fangled UEFI system? (With /boot/grub2/grub.conf, I guess you're using the traditional boot sequence.)


First, the grub.conf file is read at bootstrap installation time only to confirm its existence: the GRUB bootloader is smart enough to read the configuration file from the appropriate filesystem at runtime. Only the number of the bootable partition is embedded in the bootstrap. (LILO was the bootloader that read its configuration at bootstrap installation time and embedded everything directly in the bootstrap code.)


The tool for writing the bootstrap is "grub-install"; however, while writing the bootstrap, it will also write the various GRUB components that are normally located in /boot.


Your other drive should have a filesystem that is equivalent to /boot. Assuming that it is mounted to /mnt/boot, and that your other drive is currently visible as /dev/sdb, the command you're looking for is:

grub-install --boot-directory=/mnt/boot /dev/sdb

Also you should be paying attention to the file /boot/grub2/ (or rather /mnt/boot/grub2/, while making your other drive bootable). The BIOS-based boot selection normally works by making the selected disk the "first one" known to BIOS, or (hd0) in GRUB-speak. Therefore, if your current fully functional OS is located on /dev/sda, then /boot/grub2/ should say that (hd0) is /dev/sda, while /mnt/boot/grub2/ should say that (hd0) is /dev/sdb.


(Of course, it would be better to use /dev/disk/by-id/... or similar disk identifiers instead of /dev/sd*, so the would not need changes if you yank the other disk from the system.)


The "grub-install" command was listed in the Info documentation for GNU GRUB, which is available here in HTML form:

Valued Contributor

Re: GRUB - Need command to install BOOTSTRAP

Hello Matti;


Your answer fixed the problem. Now both drives are bootable. 


Two more questions, if you have the time.


1. I played with the grub2-install command to get a feel for it (at this point if I do something wrong I can rebuild the disk (or disks) at no great loss).


I tried moving the entries in the grub.cfg file so that my favorite O/S would boot first but all that did was change the listing order. Yes, the one I moved is now the first entry, but the original one (that was the first entry) is now in the middle and is the one that is highlighted. Can you tell me where the boot order is located?


2. Am I messing up somewhere - or is GRUB smart enough to install the bootstrap on both disks? Now, when I modify the grub.cfg file and do the install, it appears on both drives. I've tried changing the grub2-install from /dev/sdb to /dev/sda and also the which reads:


root% cat /boot/grub2/
# this device map was generated by anaconda
(hd0)      /dev/sda
(hd1)      /dev/sdb
(hd0,1)      /dev/sda1
(hd1,1)      /dev/sdb1


but I still get the information on both drives. I'll do some more checking to see if I'm doing something wrong.



tony podrasky





REMEMBER: Once you eliminate your #1 problem, #2 gets a promotion.
Valued Contributor

Re: GRUB - Need command to install BOOTSTRAP

Hello Matti;


After a lot of testing and configuring, I now have a better understanding of how things work.


Thanx for the help.





REMEMBER: Once you eliminate your #1 problem, #2 gets a promotion.