Skip to content

Instantly share code, notes, and snippets.

@chutch3
Created November 22, 2025 00:49
Show Gist options
  • Select an option

  • Save chutch3/3241a23aac2dfc317e032ceb148cccdd to your computer and use it in GitHub Desktop.

Select an option

Save chutch3/3241a23aac2dfc317e032ceb148cccdd to your computer and use it in GitHub Desktop.
Linux Boot Repair After GParted Partition Changes

Fixing Linux Boot After Resizing or Moving Partitions with GParted

Why This Happens

When you move or resize partitions, GParted may change partition UUIDs. The bootloader (GRUB) and /etc/fstab reference partitions by UUID, so those references become invalid.

Prerequisites

  • Boot from a live USB of your Linux distribution

Step 1: Identify Your Disk Layout

lsblk -o NAME,SIZE,FSTYPE,UUID,MOUNTPOINT,LABEL
sudo fdisk -l /dev/sdX   # or nvme0n1, etc.

Note the current UUIDs and identify your root partition.

Step 2: Check Boot Mode

ls /sys/firmware/efi && echo "UEFI" || echo "BIOS"

Step 3: For GPT + BIOS Only - Create BIOS Boot Partition

If you have a GPT partition table with BIOS boot, GRUB needs a small BIOS boot partition (~1-2MB):

sudo parted /dev/sdX mkpart biosboot 34s 4096s
sudo parted /dev/sdX set N bios_grub on   # N = new partition number

Step 4: Mount Root Filesystem

sudo mkdir -p /mnt/root
sudo mount /dev/sdXn /mnt/root   # your root partition

Step 5: Fix /etc/fstab

Compare UUIDs in fstab against actual UUIDs from lsblk. Update any mismatches:

cat /mnt/root/etc/fstab
sudo nano /mnt/root/etc/fstab   # fix any outdated UUIDs

Step 6: Set Up Chroot Environment

sudo mount /dev/sdXm /mnt/root/home   # if separate home partition
sudo mount --bind /dev /mnt/root/dev
sudo mount --bind /dev/pts /mnt/root/dev/pts
sudo mount --bind /proc /mnt/root/proc
sudo mount --bind /sys /mnt/root/sys
sudo mount --bind /run /mnt/root/run

Step 7: Reinstall GRUB

sudo chroot /mnt/root grub-install /dev/sdX   # disk, not partition
sudo chroot /mnt/root update-grub

Step 8: Verify and Reboot

grep "root=UUID" /mnt/root/boot/grub/grub.cfg | head -1   # verify correct UUID
sudo umount -R /mnt/root
sudo reboot

Remove live USB when prompted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment