I may have inadvertently deleted a boot partition

  • Para_lyzed
    link
    9
    edit-2
    9 months ago

    To check if you deleted a boot partition, use a liveUSB with GParted to verify your partitioning. The Fedora default partitioning scheme should have a FAT32 EFI partition followed by an ext4 boot partition, then the data partition following those. In modern Fedora, that is a BTRFS partition with the subvolumes / and /home, but it is possible you chose to use a different filesystem, such as ext4, xfs, or such. If you are missing either of these boot-related partitions, follow the steps below to recover them.

    If you deleted a boot partition, the easiest option is to use testdisk on a liveUSB to restore the partition. Here is a video tutorial for it (despite it being old, it should all still work exactly the same). Just don’t follow the instructions for installing testdisk (it’s for Ubuntu and very, very outdated) or deleting any partition (as the deletion is to demonstrate recovery). On Fedora, you can install testdisk with sudo dnf install testdisk, and I’ll let you look it up yourself if you use another distro for it. If you are unsure of what partition table type you use (GPT or MBR), you can view that in GParted, but testdisk will likely be able to detect it automatically (as is stated in the video). It should be pretty straightforward and easy.

    Another method you could choose would be to run testdisk on a liveUSB to find the boundaries of that deleted partition (here’s an article from RedHat about that), and then restore the partition map with GParted. In all reality, it achieves the same result, but requires more work, so try the other method first. I’m only really including this for the sake of completeness in case testdisk for some reason doesn’t want to restore the partition for you itself. Again, if you use the Fedora liveUSB image, you can install testdisk with sudo dnf install testdisk, but if you use anything else you can look that up yourself.

    As described in the article, you can find the boundaries of the deleted partition, and then use those in GParted to create a new partition at the same start and end points and with the same filesystem type. With Fedora’s default partitioning scheme, the first partition (EFI partition) is formatted as FAT32 and the second partition (boot partition) is formatted as ext4.

    Unless you moved/resized partitions into the space created by your deleted partition, then this should just work with no problem.

    Take this as a learning experience not to delete partitions randomly; you’ll end up breaking things by doing that. Be absolutely sure that all of your GParted queue is doing what you want to the partitions you want before selecting apply, and never do anything to a partition if you don’t know what it does. The only cases you should be deleting partitions are if you know what the partition is for, and no longer need it, or if you are deleting everything and reinstalling (which you can do by simply creating a new partition table instead of deleting partitions manually, or do through a GUI installer on a liveUSB).

  • @[email protected]
    link
    fedilink
    English
    5
    edit-2
    9 months ago

    Usually, I try to find the problem. If I can’t find it after (half) an hour or so, I’ll reinstall. It’s not worth it for me. There’s no gain in being a pro at grub (for me). Luckily, since being on atomic fedora I’ve never had any grub issues.

  • @[email protected]
    link
    fedilink
    29 months ago

    boot into something, figure out your partitions and chroot over to the fedora 39 root (with everything bound right) and do grub-install /dev/your_boot_partition after making sure the config is how you want it.

    Here’s the fedora docs on grub and here’s a stack exchange post where someone doesn’t succeed at it because they don’t troubleshoot their failed grub install. sad!

    you can also boot the install media and skip to the bootloader section and only do that part. i used to do that when i didn’t understand how to diagnose and fix grub/lilo problems. sometimes it works.