Computers & Electronics
90,462 views
25 min · 3 min read
7 steps
Advanced

How to recover from a corrupted boot partition on Linux without reinstalling the OS

A corrupted boot partition can prevent your Linux system from starting, but you can often recover it without reinstalling the entire OS. This guide walks you through practical steps to repair boot records, reinstall bootloaders, and restore critical files using a live USB. Follow each step carefully and allow 20–90 minutes depending on complexity.

Verified by pleasexplain editors
  1. Step 1: Prepare a live Linux USB

    Download a lightweight live ISO (Ubuntu, Fedora, or SystemRescue) and verify the checksum. Use a tool like Rufus, Etcher, or dd to create a bootable USB; this usually takes 5–15 minutes. Boot the target machine from the USB and choose the rescue or live desktop environment so you have a functioning shell and network.

    [Illustration: USB stick next to laptop showing live Linux boot menu on screen]

  2. Step 2: Identify partitions and mounts

    Open a terminal and run sudo lsblk -f and sudo fdisk -l to find your root and boot partitions (e.g., /dev/sda1 for EFI, /dev/sda2 for root). Note filesystem types (ext4, xfs, vfat) and UUIDs; this helps avoid mounting the wrong device. Target accuracy—double-check device names before proceeding.

    [Illustration: Terminal window displaying lsblk output with partitions labeled]

  3. Step 3: Mount the root filesystem

    Create a mount point with sudo mkdir -p /mnt/recover and mount the root partition with sudo mount /dev/sdXN /mnt/recover where sdXN is your root partition. If using LVM or encrypted volumes, activate them first with sudo vgchange -ay or open the LUKS container with sudo cryptsetup open. Verify files are visible under /mnt/recover/home and /mnt/recover/etc.

    [Illustration: Terminal showing mount command and listing of /mnt/recover directory contents]

  4. Step 4: Mount boot and system directories

    Mount the boot partition and essential virtual filesystems: sudo mount /dev/sdYM /mnt/recover/boot and then sudo mount --bind /dev /mnt/recover/dev ; sudo mount --bind /proc /mnt/recover/proc ; sudo mount --bind /sys /mnt/recover/sys. For UEFI systems also mount the EFI partition to /mnt/recover/boot/efi. This prepares a chrootable environment within 2–5 minutes.

    [Illustration: File manager view showing /mnt/recover/boot and EFI files like shimx64.efi]

  5. Step 5: Chroot into the installed system

    Run sudo chroot /mnt/recover /bin/bash to enter your installed system environment. Export network if needed: cp /etc/resolv.conf /mnt/recover/etc/ and test with ping 8.8.8.8. Chroot lets package managers and bootloader installers operate as if the system had booted normally, enabling repairs.

    [Illustration: Terminal prompt changed to show root@hostname inside chroot environment]

  6. Step 6: Reinstall or repair the bootloader

    For GRUB on BIOS systems run grub-install /dev/sdX and update-grub or grub-mkconfig -o /boot/grub/grub.cfg. For UEFI systems install grub-efi or use efibootmgr to recreate entries, e.g. grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB. Expect this to take 1–10 minutes; watch for error messages about missing modules or wrong mount points and fix accordingly.

    [Illustration: Terminal showing grub-install command output and success message]

  7. Step 7: Check and restore critical config files

    Verify /etc/fstab contains correct UUIDs (get them with blkid) and correct mount options; edit with nano or vi as needed. If kernels or initramfs are missing, regenerate them: update-initramfs -u or dracut --force, and then run update-grub again. When done, exit chroot, unmount in reverse order and reboot to test; allow 1–5 minutes for unmounting and rebooting.

    [Illustration: Text editor open on /etc/fstab with UUIDs and mount options highlighted]


  • Always back up the partition table first with sudo sfdisk -d /dev/sdX > table-backup.txt, keep a copy on an external drive.
  • If unsure which disk is which, boot a second machine and compare lsblk outputs or take photos of labels; avoid guessing device names.
  • Keep a second working USB with the same distribution to repeat steps quickly; create one in 10–20 minutes.
  • When working with LUKS, store passphrases in a secure password manager and allow 2–5 extra minutes to unlock volumes.
  • If you see EFI boot entry issues, try using the motherboard/firmware boot menu to add the EFI file manually (browse to /EFI/GRUB/grubx64.efi).
  • Log all terminal commands and errors to a file with script recover-session.log for later cross-checking with forums or support teams.

  • Do not write to the wrong device; mixing /dev/sda and /dev/sdb will overwrite data—always confirm with lsblk and UUIDs.
  • Avoid random reinstall commands: grub-install or efibootmgr with incorrect targets can make the system unbootable; triple-check device identifiers.
  • If your filesystem shows severe corruption, running repair tools (fsck) without a backup can increase risk; consider imaging the disk first with ddrescue.
  • Working with encrypted volumes requires passphrases; repeated failed attempts or damaged headers can make data unrecoverable, so proceed with caution and consider professional recovery if unsure.

Was this guide helpful?