You are on page 1of 8

USB Boot using GRUB

Date: Jan - 2006 Last Update - 1.19.2008

Using Grub to boot a USB device

Author: William Estrada

1. 2. 3. 4. 5. 6.

7. 8. 9. 10.


Abstract: Overview: Why do I want to do this?: Set Up: Sample Grub.conf: Examples: 1. Grub can find you USB devices. 2. Grub can not find USB devices: 3. This is how I did it: 4. How can I use this?: Grub failsafe: Grub GotYa's: Thing that drove me crazy. Using Grub with SBM: Allows booting from a CD. Related Links: Further reading. 1. GRUB bootloader - Full tutorial 2. Free Software Magazine: 3. Langa Letter: XP On Your Thumb Drive 4. PXE Grub for OpenBSD 5. The Grub Manual: 6. PuppyLinux: 7. Super GRUB USB Disk: Feed back: 1. From Jacopo: 2. From Bernhard: CD boot work around.

Copyright 2006 This file is free ; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This Copyright notice must be included in any distribution. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. For a copy of the GNU General Public License, write to: The Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

This procedure can enable booting from a USB device on machines that do not support USB boot devices in their BIOS.

Some PCs, SBC or Embedded systems do not support booting from USB devices. This procedure will allow you to use GRUB installed on a supported device to boot a USB device ( ie: USB Compact Flash, USB Stick, USB CD, etc. ). The procedure is quit simple but must be followed to the letter. Grub is a small kernel, it is loaded into your computer's memory and can do many helpful operations for you. It can be used to examine your machines internals. For more information about Grub, to go

1 von 8

26.04.2012 17:05

# root (hd0.124. eg. The Purest will say that this does not really boot from a USB device.04. Create a boot device that you BIOS does support This can be: CF Hard drive Floppy PXE or Network Boot Install a /boot/ partition.html Why do I want to do this?: If you don't need to do this. and then there are ways of getting things done! Set Up: Disable USB boot if your BIOS supports it.3/hacks/USB_Boot_using_GRUB. I have two IDE hard drives installed. Build your USB device system. but the Pragmatist does not care. so my USB CF is at /dev/sda or hd2.USB Boot using GRUB http://64.2012 17:05 . Sample Grub.0) kernel /boot/bzImage rw root=/dev/sda1 initrd /boot/initrd. # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/. One of Estrada's Theorems: There are ways of doing thing.conf: In this example. This write up is for the people that need to overcome a weak BIOS that does not support booting from a USB device. don't. Plug in everything and boot the machine. 2 von 8 26.0) # kernel /vmlinuz-version ro root=/dev/hda2 # initrd /initrd-version.img Here is the Grub configuration for my Soekris 4801. default=0 timeout=15 title /dev/sda1 root (hd2. At times it could be very useful for automated testing and/or field maintenance.img color green/blue black/red # Change splash page color to show this Grub is running.13.

6.04. For example. to create a Grub Boot Floppy on my system: [root@Shrek ~]$ grub-install /dev/fd0 Installation finished. Restart you computer.tar. Enter: 'ESC' to stop the timer. TARed file system for all devices: http://Mt-Umunhum-Wireless.6.gz or Grub_Floppy. Enter: root (<Tab> 5. Plug in your USB device(s) ( It must be there when Grub is loaded ).img on a device your computer will boot from. Complete the root command line: root(hdx. ( This is a show stopper ). fix it and re-run the `grub-install'. If any of the lines is incorrect.6.13.y)<enter> 8. It could look like this: Possible drives are: fd0 hd0 hd1 hd2 hd3 6.2200. This is the contents of the device map /boot/grub/device.tar.2200.conf to meet your system's setup. This will put the Grub Kernel onto a bootable device.USB Boot using GRUB http://64. 7. Edit the /boot/grub/grub.57600n81 rhgb quiet initrd /boot/initrd-2.conf to make that the default. To test your configuration: 1.2200. You must know what hardware is installed to make use of this information. 3 von 8 26.18-1. 2.fc5 ro root=LABEL=/1 console=ttyS0. Boot Grub 2. Check if this is correct or not. Enter: setup (hdx. 4. Install Grub_Floppy.0) kernel /boot/vmlinuz-2.2012 17:05 .fc5) root (hd0. (fd0) /dev/fd0 (hd0) /dev/hda (hd1) /dev/hdb (hd2) /dev/sda (hd3) /dev/sdc [root@Shrek ~]$ 6. you can update the grub. After hitting '<Tab>'. 8. Enter 'C'<enter> to get the Grub No error reported.y)<enter> 7. 5. 4. 3. Download Grub Boot set up.img Using the DD image will not require step 5. 3.html default=0 timeout=5 serial --unit=0 --speed=57600 terminal --timeout=5 serial console title Fedora Core (2.18-1.18-1.gz DD image for floppies only: http://Mt-Umunhum-Wireless. Enter: boot<enter> 9.3/hacks/USB_Boot_using_GRUB.img Examples: Grub can find you USB Once you know what works. Grub does not support 'Hot Pluggable devices'.fc5. Run grub-install against the boot device.

Or just add this configuration to your primary boot disk.6. On a USB hard drive.2911.19-1.xml?style=printable Make sure that your Kernel has built in USB support.23' mkdir /sda1 mount /dev/sda1 /sda1 Modify /etc/fstab to mount '/' from 'LABEL=kernel-2.6. 2.6.i686 . default 0 timeout 10 failback 1 title=Kernel-2.hda6 root (hd0. You can GenToo. Boot from the CD.2911 .04. they use USB hubs rather that direct USB interfaces.conf to point the Kernel root to root=LABEL=kernel-2. mkdir /tmp/iso cp /sda1/boot /tmp/iso Modify /tmp/iso/boot/grub/grub.19-1.23 default 0 timeout 10 4 von 8 26. Therefore Grub can not 'see' any USB devices at boot time.gentoo. This drove me crazy until I figured out this work around.2911.6.6. Label the file system with 'e2label /dev/sda1 kernel-2. Build a bootable CD image with the /boot file system from step 1.5) kernel /boot/vmlinuz-2. etc. FreeBSD.6. Burn the /doc/en/gentoo-x86-quickinstall.23'.5.23 root=/dev/sda1 initrd /boot/initrd-2. Create a Boot file system for the CD iso image. Build your Linux system on a removable USB device. Or copy your current system to the USB drive.2012 17:05 . then load a Kernel that points to a USB device for the root file system.img Make sure if you use this procedure that the USB file system matches the boot Kernel! This is how I did it: Here is an example that I used to validate the process.fc6.6.html Grub can not find USB devices: On some motherboards. you may need to change it to meet your configuration.fc6 ro root=/dev/hda6 rhgb quiet initrd /boot/initrd-2. You may need to rebuild the kernel.3/hacks/USB_Boot_using_GRUB. I boot from a CD or hard drive. 4. 3.6. I used sda1 as an example here. DSL.23 title FC6 .23 kernel /boot/kernel-2.13. I built a GenToo system from these instruction: http://www.6. I have a Fujitsu laptop that uses this form of USB support.USB Boot using GRUB http://64.

Grub failsafe: You can configure Grub to 'fallback' to another default boot device by using the 'fallback' key word in your grub. The timer must expire before grub will use the fallback device. you will get an error message and dropped into a interactive session. leave them all plugged in.2012 17:05 . That means you can't use the command line interface. Here is a bash script that I used: #!/bin/bash # You may need to change the CD device name! mkisofs -R -f -b boot/grub/stage2_eltorito \ -allow-lowercase \ -no-emul-boot \ -boot-load-size 4 \ -boot-info-table \ -o /tmp/$2.html title=Kernel-2.conf.13. but it works.6.23 initrd /boot/initrd-2. This only works for "Unattended operations".23 kernel /boot/kernel-2. How can I use this?: Using the above procedures.iso" \ \ \ \ \ \ This is a real waste of space! The CD is only 6 meg. Add a serial console to Grub so that you could control the booting from another PC. your CD is in and then reboot. if done right.iso $1 umount /dev/cdrom-hdc cdrecord dev="/dev/cdrom-hdc" gracetime=2 fs=4096k driveropts=burnfree -useinfo speed=24 -dao -blank=fast -pad -data "/tmp/$2.6. If your USB drive is not plugged in.23 root=LABEL=kernel- Build the iso and burn the CD. just label them differently. Just plug the device in and enter '/dev/sda1' or your disk. Great for automation/testing or remote control. Or.USB Boot using GRUB http://64. Now make sure your USB device is plugged in.04. you could build several USB drives and just plug them in when you want to boot from them. 5 von 8 26.

Grub does not support USB hubs or hot plugables. ( See feed back section and below ). 2.124.img Grub GotYa's: Thing that drove me crazy. If the USB device is not plugged in.bin initrd /boot/grub/sbootmgr.3/hacks/USB_Boot_using_GRUB.6.conf. The two files are: 1. Related Links: Further reading.6.dsk I have not tried to boot from a USB CD yet.12.13. 6 von 8 26. His very helpful URL is: http://www.lrz-muenchen. 3. sbootmgr.0) kernel /boot/bzImage rw root=/dev/sda1 initrd /boot/ Both of these files have been added to the Grub Floppy DD and tar files above.img title Fedora Core (2. memdisk. you will need to reboot Grub to see it.04. Grub will reassign the boot device to HD0. The update to your grub.1VESA ro root=/dev/hdb1 initrd /boot/initrd-2. you can add the CD boot from: http://www.conf looks like this: title Boot CD kernel /boot/grub/memdisk.lrz-muenchen.6. but it does work for IDE CDs.html By adding two files to the grub.lrz-muenchen. Using Grub with SBM: Allows booting from a CD. The Smart Boot Manager is a very nice setup.2012 17:05 .html Here is one where I could boot from a internal hard drive if the USB device is not there: default=0 timeout=15 fallback 1 title /dev/sda1 root (hd2.0) kernel /boot/vmlinuz-2. 1. Grub will not allow you to boot from a CD unless you have booted a CD to begin with.bin from: http://www.12.1VESA) root (hd1.USB Boot using GRUB http://64.1VESA. Thanks to Bernhard Treutwein for this hint.bin 2.12. You can use SBM ( Smart Boot Manager ).

html PuppyLinux: I found this Linux distro that would be prefect to use.puppylinux.2012 17:05 . Feedback on this page GRUB bootloader .html Langa Letter: XP On Your Thumb Drive Fred Langa offers a step-by-step and illustrated guide on how to boot XP from an ordinary USB The Grub Manual: I love Grub.93 and OpenBSD which provides support for NET-booting OpenBSD using PXE GRUB boot loader. Theses patches .bigpond.dedoimedo. The more I use it the more I love it. While I have not gotten back much feed back. The manual can be found here: http://www. but I won't have too much time working on that stuff.04. From Jacopo: 7 von 8 26.informationweek.jhtml?articleID=177102101 PXE Grub for OpenBSD This web page provides patches to both GRUB 0.especially the GRUB ones are somewhat ugly.html Feed back: This page has been the most active one I have written. I have noticed the hits on my server. 2006 12:00 AM Free Software Magazine: A great /index_p1. It is a very powerful tool.freesoftwaremagazine.3/hacks/USB_Boot_using_GRUB. I am experimenting with it and will post my tutorial http://www. http://www.htm Super GRUB USB Disk: This is a really good write up has well: http://users.USB Boot using GRUB http://64.124. By Fred Langa InformationWeek Jan 23.

USB Boot using GRUB http://www. Hi Bill.winusb. still experimental.3/hacks/USB_Boot_using_GRUB. I have read with much interest your page about USB booting through GRUB. please note that there is this ongoing error over the net.html -Bernhard Treutwein. from the findings of Dietmar Stoelting. It has already been included in some very interesting threads here: From Bernhard: CD boot work III A 3 Bernhard. I wrote up a tricky workaround for that due to the incorrect title given by Fred Langa to his article that does NOT describe a way to boot XP from USB. that you can find here: http://www.13.html > > you say that there is no chance to "chainload" to a bootable CD.Treutwein(at)verwaltung uni-muenchen de 8 von 8 26. there is a way to boot 2k/XP from a USB stick.911cd.04.2012 17:05 .911cd. in > > Try this: /hacks/USB_Boot_using_GRUB. see: http://www.php?showtopic=15697&hl= However.html Dear William. Ref.124. but rather on how to boot a BartPE from USB. Luckily enough. IuK.