Convertire un'installazione Debian da Legacy BIOS a UEFI: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
Created page with "=Riferimenti= *[https://gist.github.com/cjyar/cd5ea76a8692516767672ffc2883df92 Convert a disk from MBR to GPT+UEFI, in Linux. · GitHub] {{Stub}} Before starting, make sure you have a backup, and make sure to have a linux live boot ready to rescue your system. It’s easy to mess this up! <ol style="list-style-type: decimal;"> <li><p>Use gdisk to convert the partition table to GPT. > <code>gdisk /dev/sda</code></p></li> <li><p>Create the “BIOS boot” partition th..."
 
mNo edit summary
 
Line 9: Line 9:
<li><p>Reload the partition table. &gt; <code>partprobe /dev/sda</code></p></li>
<li><p>Reload the partition table. &gt; <code>partprobe /dev/sda</code></p></li>
<li><p>Re-install the GRUB boot loader using the new partition scheme. &gt; <code>grub-install /dev/sda</code></p>
<li><p>Re-install the GRUB boot loader using the new partition scheme. &gt; <code>grub-install /dev/sda</code></p>
<p>Optionally reboot to verify it’s working. If you just need GPT and not UEFI, you can stop here.</p>
<p>Optionally reboot to verify it’s working. If you just need GPT and not UEFI, you can stop here.</p></li>
 
<li><p>Use gdisk to add an “EFI System” partition (ESP with code ef00). Officially should be 100-500MB, but mine only used 130kB. Can be anywhere on the disk, so consider putting it at the end if you’re using non-resizable media like a physical disk. &gt; <code>gdisk /dev/sda</code> and use <code>n</code> to create the partition.</p></li>
-----
<li><p>Give the ESP a distinctive label without whitespace like <code>EFI</code> wth menu item  <code>c</code> because we’ll reference the partition label in fstab.</p></li>
</li>
<li><p>Use gdisk to add an “EFI System” partition (ESP). Officially should be 100-500MB, but mine only used 130kB. Can be anywhere on the disk, so consider putting it at the end if you’re using non-resizable media like a physical disk. &gt; <code>gdisk /dev/sda</code> and use <code>n</code> to create the partition.</p></li>
<li><p>Give the ESP a distinctive label without whitespace like <code>EFI-system</code>, because we’ll reference the partition label in fstab. &gt; <code>c</code> to set the label.</p></li>
<li><p>Write the partition table. &gt; <code>w</code></p></li>
<li><p>Write the partition table. &gt; <code>w</code></p></li>
<li><p>Reload the partition table. &gt; <code>partprobe /dev/sda</code></p></li>
<li><p>Reload the partition table. &gt; <code>partprobe /dev/sda</code></p></li>

Latest revision as of 19:21, 17 October 2025

=Riferimenti= *Convert a disk from MBR to GPT+UEFI, in Linux. · GitHub

Attenzione questo articolo è ancora incompleto.
Sentiti libero di contribuire cliccando sul tasto edit.

Before starting, make sure you have a backup, and make sure to have a linux live boot ready to rescue your system. It’s easy to mess this up!

  1. Use gdisk to convert the partition table to GPT. > gdisk /dev/sda

  2. Create the “BIOS boot” partition that GRUB needs. > n to create a new partition. Needs to be about 1MB. You can probably squeeze this in from sectors 34-2047. Use L or l to look up the code for “BIOS boot” (ef02).

  3. Write the new partition table. > w

  4. Reload the partition table. > partprobe /dev/sda

  5. Re-install the GRUB boot loader using the new partition scheme. > grub-install /dev/sda

    Optionally reboot to verify it’s working. If you just need GPT and not UEFI, you can stop here.

  6. Use gdisk to add an “EFI System” partition (ESP with code ef00). Officially should be 100-500MB, but mine only used 130kB. Can be anywhere on the disk, so consider putting it at the end if you’re using non-resizable media like a physical disk. > gdisk /dev/sda and use n to create the partition.

  7. Give the ESP a distinctive label without whitespace like EFI wth menu item c because we’ll reference the partition label in fstab.

  8. Write the partition table. > w

  9. Reload the partition table. > partprobe /dev/sda

  10. Build the filesystem for the ESP. > mkfs -t vfat -v /dev/disk/by-partlabel/EFI-system

  11. Create the ESP mount point. > mkdir /boot/efi

  12. Add the ESP to /etc/fstab. It should look like this: > /dev/disk/by-partlabel/EFI-system /boot/efi vfat defaults 0 2

  13. Mount the ESP. > mount /boot/efi

  14. Install the GRUB EFI package. > apt install grub-efi

  15. Install the GRUB EFI bootloader onto the disk. > grub-install --target=x86_64-efi /dev/sda

  16. Reboot.

  17. Change the BIOS from BIOS boot to UEFI boot.

  18. Use the one-time boot menu to force boot the disk. You may have to navigate to the disk -> EFI -> ubuntu -> grubx64.efi.

  19. Re-install GRUB’s EFI bootloader to update the UEFI boot selector. > grub-install

Resources