# start with liveCD
# mount and restore
mount /dev/sda2 /mnt
mount /dev/sda3 /mnt/home
mount /dev/sta1 /mnt/boot/efi
tar xvpzf /path/to/backup.tar.gz -C /mnt --numeric-owner
# fix grub
sudo arch-chroot /mnt
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=EndeavourOS
grub-mkconfig -o /boot/grub/grub.cfg
# fix default mounted
# update uuid
# create folders above excludes
sudo umount /mnt/home
sudo unmout /mnt/boot/efi
sudo unmout /mnt
how to solve
I found the Differences by compare the OpenCore EFI files.
When using grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=EndeavourOS, it will create /EFI/EndeavourOS/grubx64.efi on path /boot/efi/, but not update /boot/efi/EFI/BOOT/bootx64.efi.
When add --removable parameter, it will ignore the bootloader-id and create efi file on default path and using default name.
What is your issue exactly? It is really unclear to me…
Restoring data after partitioning the $ESP is not exactly that good (in my experience). Formatting $ESP is not recommended, or any backup restoration is advised as a solution. You always need to install the bootloader after that, to restore/create UEFI environment variables properly.
I’m sorry, my English is not very good, and using translation software may cause semantic confusion.
In fact, I would like to remind some users of old devices that after repartitioning and restoring system data, they should pay attention to using some parameters of grub-install.
Some old devices only support booting from the default path such as /EFI/BOOT/bootx64.efi, and when you use grub-install without adding the --removable parameter, it will not update to the default path mentioned above.
Actually, my $ESP partition file is the restored backup data. If I had discovered earlier that grub-install cannot create /EFI/BOOT/bootx64.efi by default.
As for why my partition number has changed, I remember that when I last created the system, the partition tool inserted an unused blank partition before the ‘/’ partition, so its partition number was (hd0,gpt3), and this time I manually created the partition, so the ‘/’ partition number is (hd0,gpt2).