Boot a USB Drive from GRUB.. or what to do when your computer can't boot from USB

I've ran into this situation before.. Had Linux installed on a machine and needed to reinstall/or install another distro. Fine, should be easy right? Load said distro on a USB stick and away we go. Unfortunately some (mostly older) machines can't boot from a USB stick. This annoys me (especially cause I really don't use writable CDs/DVDs at all anymore). It turns out if you already have GRUB1 installed on the machine, you can use that to boot the USB stick and even overwrite what's on the hard drive. This of course doesn't help you if you have no-OS or another OS -> maybe look at PXE booting.   I'm still haven't gotten this to work with GRUB2 unfortunately, they've complicated things a little.  Still it's useful for old machines.

  1. Figure out the kernel command line that your distro of choice uses (that you want to install/boot). I was using Linux Mint Debian created by Unetbootin. They (like many distros) store this in syslinux.cfg, look for the default label, and then note the items in bold. label unetbootindefault menu label Default kernel /ubnkern append initrd=/ubninit boot=live config live-media-path=/casper quiet splash --
  2. Boot target machine with USB stick inserted.  When GRUB appears Press Escape then C to get to the GRUB command line.
  3. If you only have two drives in the machine the internal one will be (hd0,0) and the external one should be (hd1,0), or similar. I typed the following, change with your version of the bolded information above, pressing enter after every command. root (hd1,0) kernel /ubnkern initrd /ubninit boot=live config live-media-path=/casper quiet splash
  4. Ready to go?  Type boot and hit enter.
Tab auto-complete works great with GRUB..  You can do root (hd to get possible target drives, root (hd0, to get possible target partitions and filesystem types, and finally list possible kernel or initrd targets.

Comments

  • muzzol says:
    i recommend to install Smart Boot Manager on MBR (sbm) and GRUB on first sector of partition. sbm can detect on the fly external drives even on very old machines.
  • kb says:
    Way too complicated 🙂 I prefer the following grub.cfg and create the ISO with grub-mkrescue on Debian Squeeze. By the way, leaving off the partition like I do here is not documented as far as I can tell. menuentry ‘First USB device’ { root (hd1) chainloader +1 } menuentry ‘Second USB device’ { #This is the fallback entry, so force the menu open when we fail as well: set timeout=-1 root (hd2) chainloader +1 } #menuentry ‘Rescue partition (TODO)’ { # set root='(hd0,1)’ # chainloader +1 #}
  • Bruneti says:
    Can I boot a recovery mac os X partition from grub prompt? I’ve got hfs+ on my iMac and grub tolds me unkwon filesystems … I need help ASAP!!!! thanks