Create an Emergency Boot Disk

"\"Gino\"" ([email protected] via blfs-dev Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.beyond.devel
Message-ID <[email protected]>
I wasn't able to create an Emergency Boot Disk with the instructions. It seems
that the grub.cfg file is being modified.

By creating two partitions, one EFI and the other ext, I solved the issue...

Try it and see...

Have a good evening!

---

### Creating an Emergency Boot Disk (using the --removable method)

1. **Initialize the GPT Partition Table**

   If you already have a partition table, it’s better to start fresh.

   ```bash
   sudo gdisk /dev/sdX
   ```

   When prompted, press `o` to create a new GPT partition table.

2. **Create the First EFI Partition**

   ```bash
   n
   [Enter] (partition number)
   [Enter] (first sector)
   300M (last sector)
   EF00 (partition type)
   ```

3. **Create the Second Linux Partition**

   ```bash
   n
   [Enter] (partition number)
   [Enter] (first sector)
   [Enter] (last sector)
   [Enter] (default type 8300)
   ```

4. **Verify and Write the Partition Table**

   ```bash
   p    # Display the partitions
   w    # Write the changes to disk
   ```

5. **Format the Partitions**

   For the EFI Partition:

   ```bash
   sudo mkfs.fat -F32 /dev/sdX1
   ```

   For the Linux Partition:

   ```bash
   sudo mkfs.ext4 /dev/sdX2
   ```

6. **Mount the Partitions**

   ```bash
   sudo mount /dev/sdX2 /mnt
   sudo mkdir /mnt/efi
   sudo mount /dev/sdX1 /mnt/efi
   ```

7. **Install GRUB in UEFI Mode**

   ```bash
   sudo grub-install --target=x86_64-efi --efi-directory=/mnt/efi --
bootloader-id=GRUB --removable --no-nvram
   ```

8. **Configure GRUB**

   ```bash
   sudo mkdir -p /mnt/boot/grub
   sudo nano /mnt/boot/grub/grub.cfg
   ```

   Content of `grub.cfg`:

   ```bash
   set timeout=0
   set default=0

   menuentry "GRUB Shell" {
       insmod terminal
       terminal_output console
       terminal_input console
   }
   ```

9. **Unmount the Partitions**

   ```bash
   sudo umount /mnt/efi
   sudo umount /mnt
   ```

10. **Test the USB Drive**

   Reboot the computer and select the USB drive as the boot device to enter
the GRUB terminal.

Now the USB drive can be used as an emergency boot disk on any UEFI x86-64
platform. Upon boot, the GRUB shell will be displayed.

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-dev
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.