When trying to format an USB drive, I accidentally formatted the /dev/sda1
file system, which appears to contain information needed to start ubuntu. I realized that so I decided to not shut down the computer, and trying to repair instead.
I tried sudo grub-install /dev/sda
, it gives me:
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
I tried using bootrepair and this gives:
GPT detected. Please create a BIOS-Boot partition (>1MB, unformatted filesystem, bios_grub flag). This can be performed via tools such as Gparted. Then try again.
This is my state now:
Is there something I can do to repair my file?
My computer is still on.
EDIT: The output of boot repair is here: boot-repair output
EDIT: RESPONSE to wjandrea, I tried changing the flag, that is why it says bios_grub flag, but I don't know how to make it "unformatted", which option is of the ones offered by gparted when formatting?
EDIT: RESPONSE to oldfred. Yes the original flag was boot. Based on this thread Problems with booting ubuntu after formatting boot partition, I searched for /sys/firmware/efi
and it exits, as indicative of an EFI boot.
My knowledge of ubuntu is nothing but having it installed on my pc once to avoid using windows. The output of cat /etc/fstab
is:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda2 during installation
UUID=bb009bf9-af36-471a-825d-505f28b194ee / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=E957-26C4 /boot/efi vfat defaults 0 1
# swap was on /dev/sda3 during installation
UUID=26cf563f-438e-41cb-a11b-30b4bb99a433 none swap sw 0 0
Thanks to all of you for your help.
/dev/sda1
. It already has the flag, so you just need to create the partition then run Boot Repair again.cat /etc/fstab
With the size of sda1, it looks more like an ESP - efi system partition which is FAT32 formatted with boot flag for UEFI boot. A normal bios_grub partition for BIOS boot is only 1 or 2MB. And Boot-Repair is trying to reinstall a BIOS boot verison of grub which then requires the bios_grub partition.boot
instead ofbios_grub
.GPT detected. Please create a BIOS-Boot partition (>1MB, unformatted filesystem, bios_grub flag). This can be performed via tools such as Gparted. Then try again.
. How can I instruct boot repair to treat the system as UEFI instead of BIOS?