MBR to GPT / GPT to MBR, UEFI and GRUB
MBR to GPT
Linux: gdisk /dev/sdX w write table to disk and exit Note: Make sure there are some after the last partition, maybe also a little before the first. If switching from legacy BIOS to UEFI, then additional changes are needed, such as creating an EFI partition and uninstalling grub-pc and installing grub-efi. Windows 10: Go to Recovery, Restart, Troubleshoot, Advanced options, Command prompt, run mbr2gpt
GPT to MBR
Linux: gdisk /dev/sdX r recovery and transformation options (experts only) g convert GPT into MBR and exit w write table to disk and exit Notes: This is risky, for some reason when testing this first, then the whole disk contents was converted into one large partition. If there are more than 4 partitions, then a type f W95 Extended (LBA) extended partition will be made to put the additional partitions in - not a type 5 extended partition made in cfdisk or gparted. This can be fixed with fdisk afterwards: fdisk /dev/sdXY p print the partition table - find the W95 Extended (LBA) partition to change to Extended t change a partition type - type partition number, then 5 for Extended w print the table to the disk and quit If switching from UEFI to legacy BIOS, then additional changes are needed, such as uninstalling grub-efi and installing grub-pc.
UEFI - Boot directly from disk name boot option
USB drives with ISO:s are possible to boot directly from the UEFI boot manager just by inserting them or selecting the drive itself in the boot order list. This is however not the case with regular disks, they require that specific entries for boot options on the drive, like "debian", are added to the list. By doing a removable drive GRUB install it becomes possible to select the drive directly in the list: grub-install --removable --force --boot-directory=/boot --efi-directory=/boot/efi /dev/sda --no-nvram This does however not stop the addition of the "debian" boot option to the UEFI NVRAM anyway when GRUB loads. https://askubuntu.com/questions/1298684/stop-grub-from-changing-the-efi-boot-order The following text flashes by in VirtualBox at least: System BootOrder not found. Initializing defaults. Creating boot entry "BootXXXX" with label "debian" for file "\EFI\Debian\debian64.efi" Another problem with this is that the boot order is not arranged automatically so the disk comes before the EFI Shell, which is the case with CD drives. So the EFI Shell boots instead of the drive.
This is a personal note. Last updated: 2021-01-19 03:13:16.