Difference between revisions of "Grub"
Line 30: | Line 30: | ||
grub-install hd0 | grub-install hd0 | ||
− | to put grub on the MBR of the first disk. | + | to put grub on the MBR of the first disk. A common error here is: |
− | + | grub-install /dev/sdb | |
− | A | + | /dev/sdb does not have any corresponding BIOS drive. |
+ | To fix that, edit /boot/grub/device.map to add the drive (as in "(hd1) /dev/sdb" | ||
A final, do it the brute force way, of installing grub is as follows (works for floppy!) | A final, do it the brute force way, of installing grub is as follows (works for floppy!) | ||
− | # cd /boot/grub | + | # cd /boot/grub |
− | # dd if=stage1 of=/dev/fd0 bs=512 count=1 | + | # dd if=stage1 of=/dev/fd0 bs=512 count=1 |
− | 1+0 records in | + | 1+0 records in |
− | 1+0 records out | + | 1+0 records out |
− | # dd if=stage2 of=/dev/fd0 bs=512 seek=1 | + | # dd if=stage2 of=/dev/fd0 bs=512 seek=1 |
− | 153+1 records in | + | 153+1 records in |
− | 153+1 records out | + | 153+1 records out |
− | # | + | # |
== The grub.conf file == | == The grub.conf file == | ||
All instruction for grub on what to do are in the file grub.conf, usually in /boot/grub. | All instruction for grub on what to do are in the file grub.conf, usually in /boot/grub. |
Revision as of 14:46, 17 January 2008
GRUB
It seems I will never really fully understand the details of how "grub" does it's stuff. This is more a quick reference, look at the real documentation for more.
Installing grub on a disk
Info: Grub Installation
To use grub you need to put the boot loader(s) onto the disk you plan to boot from. The system from which you are doing this MUST have the correct /dev/* devices. Sometimes (when using chroot say) this will not be the case. Here we put grub onto the main system disk. To use other disks, replace (hd0,0) with (hd?,0) and (hd0) with (hd?), where ? is the disk number. If you want to install grub on the partition rather then the master boot record, replace "setup (hd0)" with "setup (hd0,0)". Here are the commands:
>grub # Look for partitions that have a grub directory. grub> find /grub/stage1 (hd0,0) (hd1,0) (hd4,0) ... grub> root (hd0,0) grub> setup (hd0)
This will put grub on the first BIOS disk MBR (usually the one the BIOS tries to boot from). If you want to put it on the first partition of that drive instead, use "setup (hd0,0)" instead. Note that it MUST be either on the MBR or on the first partition, unless you are "chain-loading", which we never will be for Linux.
You can also use the script "grub-install" to install grub. This may not always work, depending on the details of the system you are working with:
grub-install /dev/sda or grub-install hd0
to put grub on the MBR of the first disk. A common error here is:
grub-install /dev/sdb /dev/sdb does not have any corresponding BIOS drive.
To fix that, edit /boot/grub/device.map to add the drive (as in "(hd1) /dev/sdb"
A final, do it the brute force way, of installing grub is as follows (works for floppy!)
# cd /boot/grub # dd if=stage1 of=/dev/fd0 bs=512 count=1 1+0 records in 1+0 records out # dd if=stage2 of=/dev/fd0 bs=512 seek=1 153+1 records in 153+1 records out #
The grub.conf file
All instruction for grub on what to do are in the file grub.conf, usually in /boot/grub.