I may have inadvertently deleted a boot partition

  • Para_lyzed@lemmy.world
    link
    fedilink
    arrow-up
    9
    ·
    edit-2
    7 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).