The Grub boot loader can be installed in the
. MBR or
. the partition boot record of a partition or
. on removable media (floppy, cd, usb key)
-grub config file is /boot/grub/grub.conf
-grub cmd /sbin/grub or /usr/sbin/grub is a small but powerful shell that supports several grub cmds.
-grub.conf is generated by anaconda, the linux installer.
-In the grub.conf file :
. all counting in grub.conf starts with 0. eg 'default=2' implies 'default os = 3rd stanza'
. splashimage = the background image for the grub boot menu.
. root = partition that will be booted (ie /boot partition).
eg: root (hd0, 6) => /dev/hda7 = /boot partition.
root (hd1, 10) => /dev/hdb11 = /boot partition.
root (hd2, 7) => /dev/hdc8 = /boot partition.
- initrd => initial RAM disk => the disk partition that contains modules needed by kernel before file systems can be mounted.
-To install grub to a removable disk use the 'grub-install' cmd
-eg: for floppy disk:
# grub-install /dev/fd0
-note: this loads the stage 1 boot loader (ie mbr) to the first sector of the floppy disk which loads stage2 boot loader ( ie grub, which lives on the hard disk)
-stage1 bootloader on floppy will still show empty when mounted as the first sector does not show up in the filesystem.
-stage1 bootloader only has a list of block addresses for stage2 bootloader.
-So if a partition address changes (say because of installation of a 2nd os on the system eg in a dual boot system), grub needs to be reconfigured in order for stage1 to locate stage2 bootloader.
-anyone having access to the grub cmd line also has access to files on the filesystems without the restrictions of file / owner permissions.
-the habit of creating a boot floppy or usb disk is good because it can help in case the mbr gets overwritten by another os install.
-even if the boot floppy or usb disk are not available, then linux install disk can be used to go in recovery mode and then mbr reinstalled.
-eg: # chroot /mnt/sysimage [ on the recovery window, to make /mnt/sysimage as root mount directory ]
# grub-install [ reinstalls mbr ]
-remember:
[[ 1st 512 bytes = mbr + partition table + bootloader (optional) ]]
[[ mbr = 1st sector = stage1 boot loader ]]
[[ bootloader = stage2 boot loader ]]
No comments:
Post a Comment