Linux Tutorial

Linux File/Directory Management

Linux Packaging And Compression

Vim Text Editor

Linux Text Processing

Linux Software Installation

Linux User/User Group Management

Linux Permission Management

Linux Filesystem Management

Linux Advanced Filesystem Management

Linux System Management

Linux Backup and Recovery

Linux System Service Management

Linux System Log Management

Linux Boot Management

LAMP/LNMP Environment

SELinux Management

Linux GRUB Disk Partition

When you install a Linux distribution, the GRUB bootloader is typically installed and configured to manage the boot process. GRUB can recognize and work with various disk partition schemes, such as MBR (Master Boot Record) and GPT (GUID Partition Table). In this tutorial, we'll go over some basic concepts and steps for working with GRUB and disk partitions.

  • Partitioning Schemes:
  • MBR (Master Boot Record): This is an older partitioning scheme that has a 2 TB storage limit and supports up to 4 primary partitions or 3 primary partitions and an extended partition containing multiple logical partitions.

  • GPT (GUID Partition Table): This is a newer partitioning scheme that supports storage devices larger than 2 TB and allows for up to 128 partitions on a single disk.

  • Installing GRUB on MBR:

During the Linux installation process, the installer should automatically install GRUB on the MBR of the primary disk. However, if you need to reinstall or repair GRUB, you can do so with the following steps:

a. Boot into a Linux live environment using a live USB or CD.

b. Open a terminal and mount the root partition of your installed Linux system:

sudo mount /dev/sdXN /mnt

Replace sdXN with the appropriate partition identifier, e.g., sda1.

c. Reinstall GRUB on the MBR:

sudo grub-install --boot-directory=/mnt/boot /dev/sdX

Replace sdX with the appropriate disk identifier, e.g., sda.

d. Update the GRUB configuration:

sudo chroot /mnt
update-grub

e. Exit the chroot environment and reboot:

exit
sudo reboot
  • Installing GRUB on GPT:

For a GPT partition scheme, you need to create a separate BIOS boot partition to store GRUB's bootloader code. Here's how:

a. During the Linux installation process, create a small (1-2 MB) unformatted partition with the "bios_grub" flag. This will be the BIOS boot partition.

b. Proceed with the installation. The installer should automatically detect the BIOS boot partition and install GRUB there.

c. If you need to reinstall or repair GRUB later, follow the same steps as for MBR, and the system should automatically detect and use the BIOS boot partition.

  • Dual Booting:

When dual-booting Linux with another operating system like Windows, it's essential to ensure that both systems use the same partitioning scheme (either MBR or GPT). The Linux installer should automatically detect the existing operating system and configure GRUB accordingly. However, you might need to manually update the GRUB configuration to ensure that both systems are recognized and listed in the GRUB menu.

In summary, GRUB can work with both MBR and GPT partition schemes, allowing you to manage the boot process on various types of storage devices. By understanding the differences between these partition schemes and how to work with them, you can ensure a smooth boot process for your Linux system.