Booting a USB from the Grub command prompt

22,069

To search for your USB drive, use the root command to choose a drive/partition and the find command to see if you found the right one.

You can go through your devices like in this example:

grub> root (hd0,0)   # first harddrive, first partition
grub> find /[tab]    # type the slash then press [tab], and it will try to list files on this partition
Error 17: Cannot mount selected partition   # Oops no file system here
grub> root (hd0,1)   # first harddrive, second partition
grub> find /[tab]
    Possible files are: lost+found var etc media ...   # That was my hard drive with my linux install
grub> root (hd1,0)   # second hard drive usually is the USB drive if you have only one internal drive
grub> find /[tab]
    Possible files are: ldlinux.sys mydoc myfile mystick syslinux.cfg  # Bingo, that's the USB stick
    Note: If you have two internal drives including your CD/DVD drive, the USB drive probably is hd2,0 and so on.

Boot the drive by entering:

chainloader +1
boot

For convenience, add these commands to your GRUB configuration (usually in /boot/grub/menu.lst):

# to boot from a USB device
title    Boot USB drive
root     (hd1,0)
chainloader +1
boot

Source: BootFromUSB - ubuntu documentation

Share:
22,069

Related videos on Youtube

Jarmund
Author by

Jarmund

Ask and I'll answer.

Updated on September 18, 2022

Comments

  • Jarmund
    Jarmund over 1 year

    I have a USB drive that I know is bootable (tested it on a different PC), but because of an ancient BIOS, I am unable to set it as a boot device in the BIOS settings.

    The computer I am using has GRUB 0.97 installed, and I was thinking: Surely it must be possible to tell grub to just boot from said USB instead? If so, the questions are:

    After loading the GRUB prompt (by hitting C in the bootloader selection), how do I see available devices to boot from? I have no idea what the USB registers as.

    Note: Yes, the computer can read the USB fine once an OS is booted. Hopefully Grub is sophisticated enough to be able to do so as well

  • Jarmund
    Jarmund almost 9 years
    Cheers for a well written and detailed response! Will test tomorrow.
  • Wayfarer
    Wayfarer almost 9 years
    @Jarmund Kudos should go to the Ubuntu Documentation community; I've just copied the content from there, changed some verbal forms and reformatted to fit the styles here :-)
  • DavidPostill
    DavidPostill about 4 years
    Please do not post the same answer to multiple questions. If the same information really answers both questions, then one question (usually the newer one) should be closed as a duplicate of the other. You can indicate this by voting to close it as a duplicate or, if you don't have enough reputation for that, raise a flag to indicate that it's a duplicate. Otherwise tailor your answer to this question and don't just paste the same answer in multiple places.