Accidantelly deleted important partition

Hello,
I am really new to partitioning and I encountered a really bad problem and I dont know how to fix it.
A few months ago I installed Linux on my laptop together with Windows in a Dual Boot system. I set it up to boot Linux Endeavour first and whenever I wanted to use Windows I exited the boot process by pressing f9. Then I was in my boot menu and could select to boot windows. However the diskspace I had previously set up for Linux wasn`t enough and I wanted to extend the partition. When I was in the partition manager I saw many partitions much of them really small (roundabaout 1Gb) I thought: " Well I don´t use this so let´s just delete it(1000mb random partition I never heard of) and add the diskspace to my Linux partition". Well turns out it actually was of some importance, beacause my EndeavourOs wasnt booting after I deleted it. I thought it was just a matter of going into the boot menu and select EndeavourOs, but it wouldn´t show up there either. So now I just have access to Windows. :frowning: It is so annoying to see the partition in the partition manager, but not being able to boot it.
please help me! What should I do?

That was probably your ESP partition.

You will need to potentially recreate it and then reinstall your boot manager.

For us to have info to help, you would need to boot off the ISO and share some information.

The first thing would be the output of sudo parted -l

1 Like

I booted off the iso and entered sudo parted -l into the terminal.
This was the output:

Model: Verbatim STORE N GO (scsi)
Disk /dev/sda: 15.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  15.5GB  15.5GB  primary  fat32        boot, lba


Model: MTFDHBA256TCK-1AS1AABHA (nvme)
Disk /dev/nvme0n1: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size    File system  Name                          Flags
 1      1049kB  274MB  273MB   fat32        EFI system partition          boot, esp, no_automount
 2      274MB   290MB  16.8MB               Microsoft reserved partition  msftres, no_automount
 3      290MB   201GB  201GB   ntfs         Basic data partition          msftdata
 4      201GB   254GB  52.6GB  ext4         endeavouros                   linux-home
 5      255GB   256GB  943MB   ntfs                                       hidden, diag, no_automount

Run these commands:

sudo mount /dev/nvme0n1p4 /mnt
sudo arch-chroot /mnt
pacman -Q | grep -E "dracut|grub|mkinitcpio"

Share the output of the last command

Ok :slight_smile:

dracut 059-1
kernel-install-for-dracut 1.7-5

You will need to recreate the ESP partition.

You can use gparted on the ISO to do this.

Ok how do I recreate it ?

Using gparted which is a GUI application, create a ~1GB fat32 partition. Add the flags “boot” and “esp” from within the tool. The size doesn’t have to be exact.

1 Like

Ok! Done it! Do I need to do anything else or is that it?

No, that was just step one.

Can you share the output of sudo parted -l again?

Sure!

Model: Verbatim STORE N GO (scsi)
Disk /dev/sda: 15.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  15.5GB  15.5GB  primary  fat32        boot, lba


Model: MTFDHBA256TCK-1AS1AABHA (nvme)
Disk /dev/nvme0n1: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size    File system  Name                          Flags
 1      1049kB  274MB  273MB   fat32        EFI system partition          boot, esp, no_automount
 2      274MB   290MB  16.8MB               Microsoft reserved partition  msftres, no_automount
 3      290MB   201GB  201GB   ntfs         Basic data partition          msftdata
 4      201GB   254GB  52.6GB  ext4         endeavouros                   linux-home
 6      254GB   255GB  1049MB  fat32                                      boot, esp
 5      255GB   256GB  943MB   ntfs                                       hidden, diag, no_automount



Oops, we need the UUID of the new partition.

Can you share the output of lsblk -o name,uuid

[liveuser@eos-2023.08.05 ~]$ lsblk -o name,uuid
NAME        UUID
loop0       
sda         
└─sda1      5E57-94EA
nvme0n1     
├─nvme0n1p1 7A71-43AC
├─nvme0n1p2 
├─nvme0n1p3 01D98272C071B3E0
├─nvme0n1p4 5807c575-81b8-461b-8d2e-e516deaa319c
├─nvme0n1p5 CA1234D71234C9E9
└─nvme0n1p6 331A-4FEB

This is it

Edit /mnt/etc/fstab or from inside the chroot /etc/fstab. Replace the UUID for /boot/efi with 331A-4FEB

If you are still in the chroot inside that terminal, you can then type:

mount /boot/efi
grub-install --bootloader-id=endeavouros --target=x86_64-efi --efi-directory=/boot/efi
grub-mkconfig -o /boot/grub/grub.cfg
exit
reboot

If you get any errors, stop running the commands and share the error output.

I ran /mnt/etc/fstab I got the following error.

[liveuser@eos-2023.08.05 ~]$ /mnt/etc/fstab
bash: /mnt/etc/fstab: Permission denied

You are not in the chroot anymore. Follow these instructions instead:

sudo mount /dev/nvme0n1p4 /mnt
sudo arch-chroot /mnt
mount /boot/efi
grub-install --bootloader-id=endeavouros --target=x86_64-efi --efi-directory=/boot/efi
grub-mkconfig -o /boot/grub/grub.cfg
exit
reboot

I encountered an error when running mount /boot/efi :

[liveuser@eos-2023.08.05 ~]$ sudo mount /dev/nvme0n1p4 /mnt
[liveuser@eos-2023.08.05 ~]$ sudo arch-chroot /mnt
[root@EndeavourOS /]# mount /boot/efi
mount: /boot/efi: can't find in /etc/fstab.

Sorry you are using systemd-boot.

Those instructions need some adjustment. Hold please…

sudo mount /dev/nvme0n1p4 /mnt
sudo arch-chroot /mnt
mount /efi
bootctl install
reinstall-kernels
exit
reboot

You can continue on starting with mount /efi

1 Like

Got an error at mount /efi:

[root@EndeavourOS /]# mount /efi
mount: /efi: can't find UUID=57C6-C772.

Did you edit /etc/fstab and swap out the UUID?