s-n-ushakov / rename-efi-entry

A Bash script to rename EFI boot entries
BSD 2-Clause "Simplified" License
84 stars 15 forks source link

Is it possible to modify file disk? #6

Closed guoh27 closed 2 years ago

s-n-ushakov commented 2 years ago

Hi @guoh27 , and please let me ask you to clarify what you mean by "modify file disk". Could you describe your use case in more detail? What kind of situation do you have, and what is the desired result?

guoh27 commented 2 years ago

For example: I run dd if=/dev/sda of=./file_disk.img, file_disk.img is a raw disk file, and I want modify its efi entry and dd it to a SD card, and I can see the modified entry when boot from this SD card.

s-n-ushakov commented 2 years ago

Hi @guoh27 , I derive from you comment that you have a specific data volume that may be copied/cloned to SD cards, and you would like to have an UEFI entry for booting from such SD data volumes. Please correct me if I got you wrong.

My first question is whether your computer/device allows booting from SD in general. That means whether it has an UEFI boot option for booting "just from SD" in addition to booting "just from HDD" or "just from SSD". By "just from ..." I mean a boot option entry for booting from just a specific device type without any knowledge of a specific data volume identifier.

If that is the case, you can try booting first "just from SD", and hopefully you may get a new more specific UEFI boot entry after that, linked to your specific volume. And you could probably use the rename-efi-entry.bash script for renaming this new boot entry afterwards.

If that is not the case, then I am not very optimistic about your task, but you still could try doing everything manually, something like that:

  1. Run the script, pretending to rename any existing specific UEFI entry, like the entry for your main OS. You just refrain from applying the suggested changes at the last step, and get a copy of suggested efibootmgr commands instead.
  2. Inspect the command for creating the new UEFI entry, and see if you have necessary data for creating an UEFI entry for your SD volume rather than for your main OS.
  3. If yes, then run the efibootmgr command manually with necessary amendments.

May that do the job for you?

guoh27 commented 2 years ago

Thank you for your reply, maybe I misunderstood where the EFI entry is kept, I thought before that the EFI entry information can be kept on disk, I am very sorry