Creating a multiple boot USB stick

February 4th, 2009   --   26 Comments »

And now for something completely different – a short tutorial on how to create an USB stick with all (well, at least a few) of the nice bootable rescue and recovery tools that exist today. It’s much more practical than having each tool on a CD, especially if you don’t have a CD drive as is the case with my Thinkpad X60s.

(c)2009 by Florian Freundt

This is my rescue and recovery USB stick, it features

I created it yesterday but had some problems getting every program to boot up properly from the boot loader. That wasn’t surprising since I never did this before and I didn’t really know what I was doing. With the help of Google and many different forum posts I got it to work though. I thought it would be nice to compile all what I learned yesterday to a simple, small tutorial. Keep in mind: I don’t have much insight on how it works and will likely not be able to help with problems, this is simply the way I did it and achieved a working result with.

So let’s start…

1 – Preparing the USB stick

You need an USB stick, about 1 GB in size should do it. Be aware that any data on it will be erased, so get your data off of it before starting. Be aware that if you do all this, you’ll do it on your own risk!

The USB stick needs to be bootable, to achieve this I used PeToUSB. It can also install BartPE in one step, but I think it isn’t necessary to include the BartPE files if you don’t want to use it.

Download PeToUSB

If you want BartPE on your stick this is the time, create the BartPE iso file. The following video (created by Runtime Software) shows you how to do that and how to include the DriveImage XML plugin:

Now insert your USB stick and start PeToUSB. Choose your USB stick as the destination and enable disk format. Point the program to your BartPE files if you want it installed (I mounted the BartPE iso file on a virtual drive) and enable file copy. Once you press start all data previously on the stick will be lost! Press start…

(c)2009 by Florian Freundt

Now you have BartPE on your USB stick, and while it should be booting already by itself you can’t choose to boot anything else from that stick. That’s why a boot loader is needed, it enables you to chose which program to boot.

2 – Installing the boot loader

There appear to be many boot loader choices available, I decided to use grub4dos.

Download grub4dos 0.4.4

Download grubinst 1.0.1

To install the grub4dos boot loader to the MBR of the USB Stick, run grubinst_gui.exe. Be sure to select the right hard disk (in my case it is hd1, it will probably be different on other system setups), otherwise you might damage your system disk’s boot sector!

(c)2009 by Florian Freundt

Once you pressed install (it’s really quick) extract the contents of grub4dos 0.4.4 into a folder and copy only the files grldr and menu.lst into the root directory of the USB stick. The contents of your stick should look like this right now:

(c)2009 by Florian Freundt

3 – Modifying the menu.lst

Open the file menu.lst from your USB stick’s root folder with a text editor. This file creates the menu you will choose from which program to boot. Presently it’s full of unnecessary stuff (at least for my purposes), I started by shorting it to this:

color black/cyan yellow/cyan
timeout 30
default /default
title reboot
savedefault --wait=2
reboot
title halt
savedefault --wait=2
halt

Every program you want to install needs an entry in this file so that grub4dos knows which program to load and how to do it. Let’s start with MemTest86+!

4 – Installing Software: MemTest86+

Download the Pre-Compiled Bootable Binary of MemTest86+. Place the file memtest86+-2.10.bin into the root of the USB stick. If you don’t want to change the menu.lst every time you place a new version on the stick, rename the file to memtest.bin. Open the menu.lst and add this code to it:

title MemTest86+
kernel /memtest.bin

That’s it, next time you boot from the stick you’ll get MemTest86+ as an option in the boot loader.

5 – Installing Software: BartPE

BartPE is already on the stick, but it has to be included into the boot loader. Add this code to the menu.lst

title BartPE
find --set-root /minint/SETUPLDR.BIN
chainloader /minint/SETUPLDR.BIN

6 – Installing Software: Parted Magic 3.5

Parted Magic is a Linux distribution that includes many programs and tools, most notably GParted for partitioning and formatting hard drives. Of course one could probably install GParted directly, but I didn’t get it to boot properly. Download pmagic-usb-3.5.zip and unpack the contents directly into the root of the USB stick. Now add this code to your menu.lst

title Parted Magic 3.5
kernel /pmagic/bzImage noapic root=/dev/ram0 init=/linuxrc keymap=us liveusb vga=791 sleep=0 quiet xvesa
tmpfs_size=350M ramdisk_size=25000 directory=/initrd /pmagic/initrd

After choosing Parted Magic from the boot loader menu it starts up and displays a splash screen, shortly after that I have to chose the parameters to enter the GUI. You might have to try the different options, the first one does crash on my system, the seconds works fine though.

7 – Installing Software: Ultimate Boot CD

Download the iso file, place it into the root of the USB stick and add this code to the menu.lst, make sure that the filenames correspond.

title UBCD 4.11
find --set-root /ubcd411.iso
map /ubcd411.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)

8 – Installing Software: TrueCrypt Rescue Disk (Updated on 2010-01-16)

If you encrypt your system hard drive with TrueCrypt you need to create a Rescue Disk. You really need this CD – if the TrueCrypt boot loader or the master key get damaged you won’t be able to access your encrypted data any more unless you boot from the rescue CD. Usually I just create the iso file and keep it on a external hard disk. Placing it on a bootable stick is much more comfortable though, once you need it. I had to use it once already, do not underestimate the importance of this rescue disk.

Create the iso from TrueCrypt or use the one you already have. Place it into the root of the USB stick. Rename it to TrueCrypt.iso or modify the following code so that the filenames correspond. Add the following code to the menu.lst

title TrueCrypt Rescue Disk
map (hd0) (hd1)
map (hd1) (hd0)
map --mem /TrueCrypt.iso (hd32)
map --hook
chainloader (hd32)

9 – Installing Software: Acronis Rescue Media

This one is a little redundant for me since I already included Acronis into my BartPE version. Anyhow, create the Acronis Rescue Media iso file with Acronis True Image and place the iso in the root of the USB stick. Rename it to acronis.iso or modify the following code so that the filenames correspond. Add this code to the menu.lst

title Acronis True Image 2009
find --set-root /acronis.iso
map /acronis.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)

10 – Summary

By now, the USB stick should be bootable and all programs installed should be accessible from the boot loader (and work). The root of my USB stick looks like this:

(c)2009 by Florian Freundt

The complete menu.lst of this setup is

color black/cyan yellow/cyan
timeout 30
default /default
title MemTest86+
kernel /memtest.bin
title BartPE
find --set-root /minint/SETUPLDR.BIN
chainloader /minint/SETUPLDR.BIN
title Parted Magic 3.5
kernel /pmagic/bzImage noapic root=/dev/ram0 init=/linuxrc keymap=us liveusb vga=791 sleep=0 quiet xvesa
tmpfs_size=350M ramdisk_size=25000 directory=/
initrd /pmagic/initrd
title UBCD 4.11
find --set-root /ubcd411.iso
map /ubcd411.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)
title TrueCrypt Rescue Disk
map --mem /TrueCrypt.iso (hd32)
map --hook
chainloader (hd32)
title Acronis True Image 2009
find --set-root /acronis.iso
map /acronis.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)
title reboot
savedefault --wait=2
reboot
title halt
savedefault --wait=2
halt

11 – Conclusion

I can not guarantee that this will work with any USB stick nor with every computer (it has to be able to boot from USB at least of course). To write this post I did every step again on a different USB stick though and it worked just fine. If you run into problems anyhow, I’m most likely not the one to ask for help. Other sources will certainly provide much better and detailed information, usually just not as simple.

One other thing: if your multiple boot USB stick works, create an image of it with DriveImage XML or any other imaging tool. This way you can recover it quickly if you accidently delete a file or have to format the stick after it had been in contact with an infected computer.

I hope this compilation does work as a tutorial and might be of help!

12 – Disclaimer

I don’t take responsibility for any damages of your system you might encounter following the actions described in this blog post. You do this on your own risk. Be aware that you might damage your running system easily (for example by manipulating the wrong boot record by accident).

26 Responses to “Creating a multiple boot USB stick”

  1. - Are You Riled Up? - » Blog Archive » Florian Freundt » Creating a Multiple Boot Usb Stick Says:

    [...] And now for something completely different – a short tutorial on how to create an USB stick with all (well, at least a few) of the nice bootable rescue and recovery tools that exist today. It’s much more practical than …Read More [...]

  2. Andy Pryke Says:

    Thanks Florian,
    this tutorial is clear and very helpful. By following steps 2 and 8 I managed to boot a TrueCrypt Rescue Disk from a USB stick, and I hope to use this method to boot any ISO from USB.

    Andy

  3. nika Says:

    Great tutorial thanks

    now i can make any bootable CD to boot from my USB Stick

  4. UsuRpergoat Says:

    Great Post, Couple of issues.
    1. I believe there is an error in the menu.lst. I am guessing that a program autocorrected your correct code to make it incorrect. for example. I am copying and pasting one entry.

    =====
    title TrueCrypt Rescue Disk
    map –mem /TrueCrypt.iso (hd32)
    map –hook
    chainloader (hd32)
    =======

    before the words mem and hook i believe it should be two hyphens not – (as i am typing this i see it autocorrect (incorrectly) in the preview part below).
    I believe that error is across the entire menu.lst infront of the words hook, set, mem and wait.

    Also in the Parted Magic section.

    =====
    title Parted Magic 3.5
    kernel /pmagic/bzImage noapic root=/dev/ram0 init=/linuxrc keymap=us liveusb vga=791 sleep=0 quiet xvesa

    tmpfs_size=350M ramdisk_size=25000 directory=/
    initrd /pmagic/initrd
    =====

    If you copy and paste that… it won’t work. The kernel line needs to be all in one line with the initrd following direct below.
    After correcting that error i tried to boot to UBCD and failed.

    I have not tried Acronis.iso or TrueCrypt.iso

    Also… could you explain why the grub menu.lst is different for UBCD.iso, Acronis.iso and TrueCrypt.iso. I don’t understand why you need different grub commands if you are just loading an ISO file. I would think it would be the same… I tried to boot from a completely different ISO file and it failed.

    Failure reads for UBCD:
    ====
    Booting ‘UBCD 4.11′

    (hd0,0)

    Filesystem type is ntfs, partition type 0×7

    Autodetect number-of-heads failed. Use default value 255

    Autodetect sectors-per-track failed. Use default value 63

    floppies_orig=0, harddrives_orig=2, floppies_curr=0, harddrives_curr=33

    Warning: Unrecognized partition table for drive A0 Please rebuild it usig a MS-compatible FDISK tool (err=14). Current C/H/S=15/255/63 Filesystem type is iso9660, using whold disk

    Warning: Unrecognized partition table for drive A0 Please rebuild it usig a MS-compatible FDISK tool (err=14). Current C/H/S=15/255/63

    Warning: Unrecognized partition table for drive A0 Please rebuild it usig a MS-compatible FDISK tool (err=14). Current C/H/S=15/255/63 chainloader (hd32)

    Error 1: Filename must be either an absolute pathname of blocklist
    ===========

    So maybe i’m doing something wrong… or mabe Grub can’t read ISO’s or maybe the menu.lst is wrong… Help Please.. I would love to have any ISO in root and boot anything i would like.

    UsuRpergoat

  5. Florian Freundt Says:

    Thanks for catching those single hyphens! It was indeed the auto-formatting done by WordPress that created those errors, it should be fixed now. I also fixed the broken line in the Parted Magic section.

    Regarding your question on booting ISO files and the different codes I have to admit that I can’t help you there – as I said in the post, I don’t really know this stuff well enough, it’s just the way it works for me. Sorry.

  6. Roland Says:

    Hello. That was the one most usefull tutorial I ever seen on web. Thank you very much. I want to know if there’s a way of putting Knoppix, Ubuntu, Win XP and VirtualBox in to that usb pendrive? I tried and failed about Ubuntu and Knoppix. I would really apriciate more if you could just let me know.. Thanks anyway..

    rolanddes@gmail.com

  7. Alan Says:

    Great tutorial.
    I’m having a problem booting into the TrueCrypt rescue disk.

    It’s boots fine, but then tells me my password is incorrect. The iso file is identical to the rescue CD which operates properly.

    Any ideas?

  8. Florian Freundt Says:

    In principle, adding full portable Operating Systems should only be limited by the Sticks size – it might require a little more knowledge though. I did try to include an Ubuntu iso but it didn’t work right away and I didn’t have any need to investigate that option further.

  9. mll Says:

    Great tutorial indeed, thanks !

    FYI, I couldn’t get Parted Magic 3.5 to work, it shows 2 linux penguins, about 4 lines of code speaking of panic – see how clueless I am… :/ – and that’s about it.

    Neither does System Rescue CD‘s iso work properly (i used the settings you supplied for ubcd)

    On the other hand, I could get an iso image of UBCD to boot with the same parameters you provided.

  10. BluE Says:

    @Alan: thats because the boot loader finds the usb stick as the first hdd and tries to encrypt it… got the same problem actually, trying to fix it..
    I found this: It might help you:
    http://forums.truecrypt.org/viewtopic.php?p=57113

  11. Multi-LiveCD USB Boot? - Overclock.net - Overclocking.net Says:

    [...] keys, so I was looking for a way to condense them into one single USB with a GRUB menu. I found: http://florian.freundt.org/blog/?p=161 But, whenever I try booting into the ISO, it either pushes me to Busybox, or says the Media cannot [...]

  12. Question for bootable USB stick with GRUB - Raymond.CC Forum Says:

    [...] I used: grub4dos-0.4.4-2009-06-20 grubinst-1.1-bin-w32-2008-01-01 And am following this guide: http://florian.freundt.org/blog/?p=161 Assistance would be much [...]

  13. @Erick Says:

    Nice guide…is it possible to create a multi boot usb stick which contains all Operating System?

  14. Florian Freundt Says:

    it’s possible with linux, but I don’t think that would work with windows.

  15. Claude Says:

    excellent article. I have been able to use it to create a TrueCrypt Rescue “Disk”.

    I am trying to extend it to run Clonezilla. I don’t really know what I am doing here, so I took the closest entry from the examples above in order to create the following entry in the menu:

    title Clonezilla
    find –set-root /Clonezilla.iso
    map /Clonezilla.iso (hd32)
    map –hook
    root (hd32)
    chainloader (hd32)

    (and copied Clonezilla.iso to the root folder)

    However I get the following error:

    Error 62: The number of heads must be specified. The “–Heads=0″ option tells map to choose a value (but may be unsiutable for you)

    Any ideas?

    Cheers,
    Claude

  16. Florian Freundt Says:

    Sorry Claude, as I said in the article I don’t really know the stuff myself and since I switched to OSX I didn’t use this stuff any more.

  17. Steve Reeves Says:

    Hey,

    Thanks for posting all of this information, you are partly responsible for Steve’s Ultimate Boot USB. I created Steve’s Ultimate Boot USB (SUBU) to meet my own personal bootable requirements and have now released it for everyone to use.

    please see hxxp://stevereeves.biz

    Thanks again for posting all of this info. on grub!

  18. Tero Says:

    Very much thanks for helping to understand. My multiboot USB works now fine and I can add what I want. Thanks, Thanks! :)

  19. Ioupeka Says:

    Hi all,

    here a link of automatized usb multiboot stick:
    http://www.pendrivelinux.com/boot-multiple-iso-from-usb-multiboot-usb/

  20. manicmyron Says:

    Does any1 know the command to boot from hard disk to be writtern in menu.lst ???????

    thnks

  21. Mark Says:

    Anybody knows how to add Partition Magic? Did anybody try that?

    Many thanks in advance ;)

    Mark

  22. Mark Says:

    … Sorry, I forgot to type a HUGE THANKS to Florian for this amazing thread!!!

    Cheers,

    Mark

  23. ICT nieuws t/m week 25 - Bob's Nieuws Says:

    [...] http://florian.freundt.org/blog/?p=161 [...]

  24. Sebastian Says:

    You saved my day :)

  25. Mike Says:

    Hey Florian,

    This is an excellent tutorial. I tried it the first time and it worked booting from my Sony 4gb flash drive. I have my Toshiba netbook Truecrypt-ed and wanted to be able to boot the rescue ISO in case the boot loader gets corrupted. I tested it and it worked fine. I’ve been to Boot-land.net for other resources but it is way over my head and some of the tutorials I’ve read are contradicting.

    Thanks again,
    Mike

  26. Keke Says:

    (ad pt.2) How do i find out which hd (1,2 etc) my Usb-Stick is?

Leave a Reply