Table of Contents
Question
The user seeks to create a dual-boot USB flash drive capable of booting into two distinct environments:
- A WinPE (Windows Preinstallation Environment).
- A secondary GRUB partition offering a menu to boot various tools.
The user envisions a GRUB-based menu system that allows seamless navigation between these options. They are aware of the need for multiple partitions and have some familiarity with GRUB commands but are unsure about the exact steps, particularly regarding partition setup and bootloader configuration.
Solutions
Here’s a detailed guide to creating a dual-boot USB flash drive with GRUB:
Step 1: Partition the USB Drive
Use partitioning tools like GParted or Disk Management (Windows) to divide the USB into multiple partitions:
- Partition 1: FAT32 for GRUB files.
- Partition 2: FAT32 or NTFS for WinPE files.
- Additional partitions can be created for other tools or ISOs as needed.
Step 2: Install GRUB Bootloader
Install GRUB on the first partition using the following command:
sudo grub-install --target=i386-pc --boot-directory=/mnt/usb/boot /dev/sdX
Replace /dev/sdX with your USB device identifier.
Step 3: Configure GRUB Menus
Create a grub.cfg file in /boot/grub/ on the first partition. Example configuration:
set timeout=10 set default=0 menuentry "Boot WinPE" { set root=(hd0,2) chainloader +1 } menuentry "Boot Tools Menu" { set root=(hd0,3) configfile /boot/grub/grub.cfg }
Adjust (hd0,2) and (hd0,3) to match your partition setup.
Step 4: Add Tools Menu (Optional)
If you want additional tools, create another grub.cfg file in the second GRUB partition:
set timeout=10 set default=0 menuentry "Tool 1" { set root=(hd0,4) linux /vmlinuz root=/dev/sdX4 initrd /initrd.img } menuentry "Tool 2" { set root=(hd0,5) linux /vmlinuz root=/dev/sdX5 initrd /initrd.img }
Update paths and partition numbers as necessary.
Step 5: Test and Debug
Boot from the USB and test each menu option.
If partitions don’t load correctly, verify their order and update set root commands accordingly.
For MBR systems, ensure partitions are marked as active using:
parttool (hd0,msdosX) boot+
Alternative Solution: Ventoy
For users seeking simplicity, consider Ventoy:
- Ventoy is an open-source tool that creates bootable USB drives for ISO files.
- Simply copy ISO files to the USB drive; Ventoy automatically generates a boot menu.
- While some users find its interface less customizable, it’s efficient and user-friendly.
Common Challenges and Tips
- Partition Order Matters: Ensure partitions are logically ordered; some users report issues when partitions are misaligned.
- Non-Linux ISOs: For Windows-based ISOs (e.g., Macrium Reflect), use chainloading techniques similar to Linux setups.
- Debugging Errors: If errors like “NTLDR missing” occur, ensure the correct partition is active and verify file paths.
This guide provides both technical depth and practical advice for achieving a dual-boot USB setup tailored to individual needs.