Page List

Wednesday, June 12, 2024

CBT Nugget: Linux Server Administration - 3. Boot File Locations

Boot File Locations in GRUB and GRUB2

The boot files and configuration locations for GRUB (Legacy GRUB) and GRUB2 are different due to their structural and functional differences. Here's a detailed overview of where these files are typically located:

GRUB (Legacy GRUB)

1. Configuration Files:

  • Primary Configuration File: /boot/grub/menu.lst or /boot/grub/grub.conf
    • This file contains the boot menu entries and configuration directives.

2. Bootloader Files:

  • Stage 1: Typically installed in the Master Boot Record (MBR) or the boot sector of a partition.
  • Stage 1.5: Located in the first 30 KB of the hard disk immediately after the MBR. This stage bridges Stage 1 and Stage 2.
  • Stage 2: Stored in the /boot/grub/ directory. This stage is responsible for loading the operating system kernel.

3. Kernel and Initrd Files:

  • Kernel: /boot/vmlinuz
  • Initrd: /boot/initrd.img or /boot/initrd

GRUB2

1. Configuration Files:

  • Primary Configuration File: /boot/grub/grub.cfg
    • This file is automatically generated and should not be edited directly.
  • Default Configuration File: /etc/default/grub
    • This file contains user-editable settings that determine the contents of grub.cfg.
  • Custom Scripts Directory: /etc/grub.d/
    • Contains scripts that are executed to generate grub.cfg.

2. Bootloader Files:

  • Core Image (Stage 1): Installed in the MBR or the boot sector of a partition. Typically located at /boot/grub/i386-pc/ (or architecture-specific directory).
  • Modules and Support Files: Stored in /boot/grub/ directory. Modules provide support for different filesystems, commands, etc.

3. Kernel and Initrd Files:

  • Kernel: /boot/vmlinuz-*
    • Example: /boot/vmlinuz-5.4.0-72-generic
  • Initrd: /boot/initrd.img-*
    • Example: /boot/initrd.img-5.4.0-72-generic

Detailed Directory Structure

GRUB (Legacy GRUB)

  • /boot/grub/
    • menu.lst or grub.conf: Main configuration file.
    • stage1, stage1.5, stage2: Core bootloader files.

GRUB2

  • /boot/grub/

    • grub.cfg: Main configuration file.
    • i386-pc/, x86_64-efi/, etc.: Architecture-specific directories containing core.img and other modules.
    • fonts/, locale/, themes/: Directories for graphical menu support.
  • /etc/default/:

    • grub: User-editable configuration file.
  • /etc/grub.d/:

    • 00_header, 10_linux, 30_os-prober, etc.: Scripts that generate entries in grub.cfg.

Example Configurations and Commands

GRUB (Legacy GRUB):

  • Example menu.lst:
    plaintext
    default=0 timeout=5 title Linux root (hd0,0) kernel /vmlinuz root=/dev/sda1 initrd /initrd.img

GRUB2:

  • Example /etc/default/grub:

    plaintext
    GRUB_DEFAULT=0 GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX=""
  • Generating grub.cfg:

    sh
    sudo update-grub

Summary

Understanding the locations and purposes of these files is crucial for managing the boot process in Linux. GRUB2, with its modern features and improved structure, provides a more flexible and robust boot management system compared to Legacy GRUB.

פוסט מוצג

CBT Nugget: Linux Server Administration - 13.Identifying Red Hat and CentOS Network Configuration Files

13.Identifying Red Hat and CentOS Network Configuration Files In Red Hat Enterprise Linux (RHEL) and CentOS, network configuration is manag...