Booting a computer system from removable USB media is a versatile technique used for recovery, diagnostics, installations, and portable environments. The GRand Unified Bootloader (GRUB) offers advanced control over the boot process, allowing USB drives to be booted even on devices lacking native support. This comprehensive guide will unpack how to leverage GRUB to boot from USB drives across 2630 words.
Prerequisites for GRUB USB Booting
Before diving into the GRUB commands, ensure your system meets these prerequisites:
GRUB Installation
GRUB must be installed as the active bootloader. Most Linux distributions like Ubuntu automatically install GRUB. For Windows bootloaders, the GNU GRUB package can integrate GRUB alongside existing loaders. On Macs holding Apple‘s boot manager, third-party tools help set up GRUB.
# Check for GRUB
sudo update-grub
USB Drive
You‘ll need a USB drive holding a bootable operating system image, created with utilities like Rufus (Windows), Startup Disk Creator (Ubuntu), or dd (Linux). Popular bootable USB images include:
- Linux distribution installation media
- Windows or Linux recovery ISOs
- Hardware diagnostics tools
- Portable live systems
BIOS Support
The system‘s BIOS or UEFI firmware settings must permit booting from USB drives. This is enabled by default on most modern hardware. If USB boot options are missing, access the BIOS setup screen on startup to enable this capability.
Secure Boot
Microsoft‘s Secure Boot protocol can block unauthorized bootloaders like GRUB. While beyond this guide‘s scope, you may need to sign GRUB with machine owner keys or disable UEFI Secure Boot altogether if issues arise.
With those prerequistes covered, let‘s dig into booting USB drives from that GRUB prompt.
Accessing the GRUB Menu
When powering on the device, watch for the initial boot splash screen or manufacturer logo. Rapidly tap the ↹ Shift, ⎋ Escape or other keys to interrupt the default OS boot and reach GRUB. The exact key and quick timing depends on your hardware, try these common options:
| Key | Detail |
|---|---|
| ↹ Shift | Hold Shift immediately on startup |
| ⎋ Escape | Rapidly tap Escape key |
| F8 to F12 | Hit F10 or another function key |
If GRUB doesn‘t appear, reboot and retry more quickly on the key entry.
Once successful, you‘ll reach a menu or prompt like:
GNU GRUB version 2.04
Minimal BASH-like line editing is supported. For the first word, TAB lists
possible command completions. Anywhere else TAB lists possible device or
file completions.
grub>
Take note of the grub> prompt indicating we‘ve entered the GRUB shell.
Listing the USB Drive in GRUB
From the GRUB command line interface, query connected drives with ls:
grub> ls
(hd0) (hd1) (hd2) (hd4)
This prints all block devices mapped to hdX handles. Our 16GB USB stick appears as (hd1) here. We need to inspect closer:
grub> ls (hd1)/
Partition hd1,gpt1: Filesystem type fat - Label ‘MyUSB‘, UUID abcd...
Partition hd1,gpt2: Filesystem type ext2 - Label ‘(null)‘
Now the partitions on (hd1) are shown, we want the second for our live Linux system.
💡Note: Drive and partition numbers can vary between boots. Rely on the filesystem labels and sizes to identify your USB unconditionally.
We‘ll set (hd1,gpt2) as the boot drive next.
Setting the Root Boot Device
Choose the USB partition housing our bootable system files:
grub> set root=(hd1,gpt2)
Verify this via ls, seeing our target partition mounted at root /:
grub> ls
(hd0) (hd1) (hd2) (hd4)
Filesystem: ext2
/
With the USB as root, we can access its bootloader.
Chainloading the USB Bootloader
USB images contain bootloaders like /EFI/boot/bootx64.efi to launch the OS. We‘ll delegate to this external bootloader using GRUB‘s chainloader command:
grub> chainloader /EFI/boot/bootx64.efi
As this boot path can vary, use ls first to discover the exact bootloader file if issues arise.
💡 Tip: Adding
bootafter the chainloader command boots immediately. Remove it to reach the USB‘s distinct boot menu.
Initiating the USB Boot
Safe now with the appropriate root device and bootloader chains set, call boot to fully hand-off control:
grub> boot
This closes GRUB, passes execution to our USB‘s bundled bootloader from the previous step, ultimately reaching the live session desktop!
USB Boot Troubleshooting
If your USB deploy fails to boot properly, double check:
- USB created correctly via media writing tools without errors
- USB disk and partition IDs matched properly
- Operating system on USB matches computer environment (64-bit, UEFI, etc)
- GRUB identifies USB drive properly via updated
lschecks - BIOS supports chosen boot mode like UEFI or Legacy CSM
- Other devices left plugged in could be interfering
Gather any new error messages arising and research further as needed.
Customizing the GRUB USB Experience
Beyond standard booting, GRUB offers customization like:
splashimage – Set background image
gfxpayload – Adjust resolution
configfile – Change menu configs
Here we set a background wallpaper.img for our live device:
grub> set splashimage=(hd1,gpt2)/boot/grub/wallpaper.png
grub> set gfxpayload=keep
grub>configfile (hd1,gpt2)/boot/grub/grub.cfg
Tweak these parameters to modify the USB boot aesthetics.
Persisting Changes on Live USBs
For live systems on USB lacking hard disk installations, boot choices and data will be lost on shutdown.
To save customization or documents persistently, reserve USB space for an overlay file system using utilities like mkusb or Fedora Media Writer.
Alternatively, copy data manually into partitions like FAT32 labeled casper-rw.
Now your USB can store browser bookmarks, application settings and other personalization between reboots!
Alternative Boot Methods
While powerful, chaining GRUB to load USB drives is not your only option:
Native Boot Menus – Simple, direct,platform-specific support
ISO Emulation – Mounts images digitally via hypervisor
Network Booting – Boots thin clients from LAN without media
PXE Booting – Leverages DHCP and TFTP for imaging
GRUB shines forthose wanting unified, fully-featured control beyond BIOS or EFI. For quick needs like Windows password resets, a tool‘s native boot menu could suffice as well.
Evaluate all approaches against your use case. Diskless boots often demand PXE‘s hardware compatibility and scalability too.
Understanding GRUB Boot Principles
Under the hood, how does GRUB take raw OS image files on USB and boot them natively?
On initialization, GRUB probes devices for bootable partitions via signature headers in filesystem superblocks. Once mounted, the binary kernel images and init RAM disks can be directly executed.
GRUB parses partition tables like GPT, MBR, or APM to address logical or primary volumes for mounting. Multiboot specifications provide sane memory layouts for loading multiple concurrent operating systems too.
As an intermediary between the firmware POST, BIOS, UEFI, and final OS, GRUB abstracts platform differences with a universal, portable implementation.
References and Learning More
GRUB draws from years of documentation worth consulting:
- GNU.org – Main manuals & user guide
- Wiki Page – General background
- Specifications – multi-OS boot protocols
- Manpage Catalog – Command help
With those references, you now have the fundamentals to leverage GRUB for effective USB booting. From recovery tools to portable desktops, GRUB‘s flexibility helps boot well beyond what BIOS alone can handle.
Whether setting up scripted multiboot scenarios or interactively debugging custom kernels, put GRUB‘s commands to work on your next platform project.


