Score:0

How can I Re-Install 'EFI Partition System' & 'Partition table entries are not in disk order' warning

br flag
nfs

I use Ubuntu 20.04. I have overwritten my EFI partition system. Then I deleted it. After I deleted it, the space became unallocated. (I opened and finalized another question for this issue question link) I have recovered it with Testdisk.

Now, I have formatted the unallocated 513 MB (which was the EFI partition system). I am trying to reinstall what was missing. Unfortunately I couldn't quite catch the idea behind what should I install and how to mount them.

My questions are:

  • Before deleting the EFI partition, the file system was UDF. Now I can't format udf with gparted. What is the difference from fat32. Should I use fat32?
  • sudo fdisk -l /dev/sda output says: "Partition table entries are not in disk order." What should I do?
  • How should I proceed?

Partitions: after overwriting the EFI System Partition
EFI System Partition details, utf
After I deleted the EFI System Partition
After I recoverd it with testdisk
EFI System Partition details, fat32

Updates:
It turned out I recovered the MBR partition table. I search for the GPT partition table on Testdisk and I wrote that partition table. Then boot partition became sda1 and ubuntu os partition became sda2. GPT partition table version. Testdisk recovered it as msftdata

Output of sudo fdisk -l /dev/sda:

Disk /dev/sda: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 860 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdfa258ef

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sda1       1050624 976771071 975720448 465.3G 83 Linux
/dev/sda2  *       2048   1050623   1048576   512M ef EFI (FAT-12/16/32)

Partition table entries are not in disk order.

Output of sudo gdisk -l /dev/sda:

GPT fdisk (gdisk) version 1.0.5

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: present

Found valid MBR and GPT. Which do you want to use?
 1 - MBR
 2 - GPT
 3 - Create blank GPT

Your answer: 1
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Model: Samsung SSD 860 
Sector size (logical/physical): 512/512 bytes
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 4077 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1         1050624       976771071   465.3 GiB   8300  Linux filesystem
   2            2048         1050623   512.0 MiB   EF00  EFI system partition

After changing the partition table from MBR to GPT with Testdisk:

GPT fdisk (gdisk) version 1.0.5

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Model: Samsung SSD 860 
Sector size (logical/physical): 512/512 bytes
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 4077 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1050623   512.0 MiB   EF00  
   2         1050624       976771071   465.3 GiB   8300  

I seek your help and your experience.
Thank you,

oldfred avatar
cn flag
what brand/model system? What video card/chip? if only one system installed, it can be booting thru grub, but hang up on rest of boot, often video issue. Can you press escape between UEFI screen & when grub menu should show to get grub menu. And then boot recovery mode? And Lets see details, use ppa version with your live installer (2nd option) or any working install, not Boot-Repair ISO: Please copy & paste the pastebin link to the Boot-info summary report ( do not post report), do not run the auto fix till reviewed. https://help.ubuntu.com/community/Boot-Repair
Nmath avatar
ng flag
Overwritten data is unrecoverable. However you may be able to regenerate the needed boot information with `boot-repair`. This utility must be used from a live session. Here are [instructions](https://askubuntu.com/a/182863). You might also try `sudo update-grub` which can be run from your installed system. Try one or both as they do different things.
user10489 avatar
in flag
I don't know why an EFI partition would be UDF rather than vfat. You can recreate the EFI partition, mark its type as EFI, format it vfat, and run `grub-install` to rebuild its contents. There's nothing in the EFI partition that there isn't a copy of somewhere else, so it can be rebuilt without trying to recover what was in it.
oldfred avatar
cn flag
With UEFI system, better to use gpt, so select 2 to recover gpt partition tables. Gpt has both primary at beginning of drive & backup at end of drive. https://askubuntu.com/questions/386752/fixing-corrupt-backup-gpt-table/386802#386802 UDF is a DVD drive. You should only see that with DVD or a flash drive written as a hybrid DVD/flash drive which does not have standard partitions.
br flag
nfs
@oldfred selection 2(gpt) shows a different partition table. EFI Partition System is 1.4 MiB and rest 465.3 GiB. 512 MiB part is not in the GPT partition table. But it is in the MBR. What should I do?
oldfred avatar
cn flag
You can backup partition table first and save to another device. `sudo sfdisk -d /dev/sda > backup_sda.txt` What then does sfdisk show with ESP or without? You can also convert MBR to gpt, if you have good data backups. Converting from MBR to gpt: http://ubuntuforums.org/showthread.php?t=1454252 With UEFI, gpt is standard, but Ubuntu will let you use MBR (and should not). But then was drive originally MBR or gpt?
br flag
nfs
@oldfred, I found the gpt partition table with Testdisk. When I wrote it became normal. I added to `Updates:` section. Thank you.
br flag
nfs
@user10489 on which partition should I use the `grub-install` ?
oldfred avatar
cn flag
You always specify a drive, not a partition for grub boot loader install. But with UEFI and Ubuntu's Ubiquity installer, any choice you make is ignored. It always installs to first drive and always puts boot files into the ESP - efi system partition on that drive. If FAT32 partition on first drive not flagged as ESP, it will error on grub install.
br flag
nfs
@oldfred Now, I've just installed as it pointed. But when i restart it didn't boot from the ssd. On ubuntu/motherboardname screen, wait symbol turned continuously. I guess it couldn't find the links, mount point etc. I don't know what should I update :) . What could be the reasons?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.