Lost boot sector partition

Help! my boot sector partition has been switched to fat32 somehow, does anyone know how I can restore it?

Hey @MacksM3!
Do you happen to have Windows in another drive by any chance? M$ updates tend to be quite sneaky in that regard.
When you open up that partition, does it have the boot sector files in it?
If yes -
Copy them to an external USB as they are and then format the /dev/sda1 with the ext4 filesystem and the boot flag active. Then, copy the boot files/folders back.

If no-
A fast way to fix that is via the Boot-Repair application. This can be installed (temporarily) even when you boot via Live-USB, via

sudo apt install boot-repair

However, first check if your Live-USB has the Boot-Repair application installed already. I’m aware that Zorin OS comes with it for emergencies. This is something I used to utilize when I had Linux and Windows that utilized the same boot partition (after a dreaded Windows update). After that, I would always have 2 Linux distros installed and I’d fix one by using the other.

If nothing above works, and you have then we will need to go through a chroot process, where we’ll be using the Live-USB command set to enter your installed Linux and order it to fully restructure the boot partition and reinstall Grub.

Please let me know if any of the two options above helps first. :slight_smile:

Hi Vasileios,
the install boot-repair resulted in
m3@debian-desktop:~$ sudo apt install boot-repair
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
E: Unable to locate package boot-repair

system is running without boot sector because I found it while working on bootable USB drives

Looks the the partition got formatted

I was able to make changes to that partition with testdisk,
still have an error but it is now an EFI system boot partition

1 Like

Formatted would be my guess… but it begs the question “how did that happen?!” :laughing:

I’m glad you at least got it to work. Do you know if something took place that brought these effects? :slight_smile:

I was trying to create a multiboot USB and decided to try running YUMI in WINE.
Next thing I know my boot partition has an error.

1 Like

Hi Vasileios
What does a working boot sector look like? What files are in there? How would I look at the boot sector of the machine currently running?

Hey @MacksM3!
The boot sector, especially the UEFI, has a set of folders that contain .efi files and - at times - the so-called shim ones. Believe it or not, this makes it easier to install or remove boot-loaders from it (like Windows), by just copying - or removing - the respective Microsoft folder. Back when I was experimenting with the boot sectors, I would keep a copy of the entire boot partition (via a simply copy-paste), so that I could bring back the boot files - in case I destroyed something. The good thing is that when you do that, those boot loaders become visible from the BIOS as well.

The only way to view a Boot partition on a running Linux system is to visit it as Super User. Which - depending on the distro you have installed - can be accessed via:

sudo su
cd /boot

Or (for fedora or Manjaro/Arch, if the root user is enabled):

su
cd /boot

Then the ls command will show you the contents.
Another way to do it is if you execute the sudo su or the su command and then run:

nautilus

If you are in a Gnome environment, or:

dolphin

If you are in a KDE environment. Or…

nemo

If you are in a Cinnamon environment (like Linux Mint).
This will start your file manager with root privileges, which will allow you to visit and copy the /boot folder. However, be very careful when going to your file manager as root, as any wrong action will reflect on your system. :slight_smile:

I am able to to view as you said, it looks like this


Clearly I have objects in my boot folder. My concern was that they were all deleted.
Does it appear that everything is intact?
I don’t want to shut this system down and not be able to start it back up again.

Hey @MacksM3!
Yes, everything looks as it should on the top level.
You might want to do an:

ls -l

So that you can clearly see which one is a directory.
Jump into the efi one and then check the sub-folders with the ls -l command to see what’s in there. You can do so via:

cd /boot/efi

As long as you’re still root.
The actual boot-loaders that fire up your OS are inside that efi folder.

1 Like

Hey Vasileios,
thanks for that hint. I do see files down the tree, but a couple odd things;
I don’t need to be logged in as root to see those files. When I set up this machine, I added my user to a group that I think is a super user group. all the boot files are visible in my file manager also.
The other odd thing is I have an ubuntu folder under /boot/efi/EFI, but I thought the drive was wiped after I switched from ubuntu. I loaded mint between ubuntu and debian but there is no mint folder.
Anyway, I am a lot more comfortable now that it appears my boot sector is still intact.
Thank you so much for all your help.

1 Like

That is great to hear @MacksM3!
Also, when you do a reinstallation, when the formatting parameters of the boot partition are the same, then an actual format does not occur. This is why you still see some of the older .efi boot loaders. If - for example - you manually change the size of the boot partition, then a format will be forced, and the boot loaders will disappear.

1 Like