1

After reading an AskUbuntu question on 2-partition live USB drives, a StackExchange question on partitioning bootable USB drives, Ubuntu forums on bootable USB drives with partition, and many other resources I've spent the last 2 days utterly failing to create what I want.

I just purchased a 32 gigabyte flash drive. I desire to make this flash drive into a multi-tool for fixing any computer issue I might encounter from opening a word document to recovering a lost password. My plan to do this was to put two partitions on the drive:

  • a 28 GB data partition which would hold multiple portable programs (Open Office, GIMP, a hex editor, etc)
  • a 4 GB partition with Kali Linux installed

I've tried using fdisk, gdisk (GPT fdisk), and Mac OS X's built-in partitioning tool to create these partitions. I've also tried various combinations of block allocation, preceding free space, EFI partition sizes, etc. I've tried using just an MBR, a hybrid MBR+GPT, and just GPT.

No matter what I do the results are the same: The 28 GB partition can be seen by all computers (Mac, Windows, Linux), the 4 GB partition can be seen by non-Windows computer (Mac, Linux), but no partitions can be seen by BIOS. I simply can't boot from it.

To install Kali Linux I'm using the following command with the ISO downloaded from their site:

sudo dd if=~/Downloads/kali-linux-2.0-i386.iso of=/dev/disk2s3 bs=1m

I've also tried changing the .iso file to a .img file per Ubuntu's guide on installing Linux to a flash drive, but using this instead had no effect.

I've also tried a few of the guides here on SuperUser, including this guide on installing Knoppix with a second partition which puts Knoppix on the first partition and the drive therefore won't work in Windows.

I'm sure I'm missing something simple, but I'm pulling my hair out trying to figure out what it is :) Why doesn't BIOS see my flash drive?

Update

Another day, another try.

After staring at the forums and the .iso file I finally put two and two together and realized that the .iso file already contained an MBR. Writing the .iso to a partition was redundant. However this caused a conundrum: how do you write all of the .iso except its MBR?

I had an interesting idea that I gave a try:

  1. I shredded the flash drive to rip out the MBR, partitions, etc
  2. I copied the .iso over (using dd) so it functioned like a normal 4 GB Kali Linux drive
  3. I used fdisk to edit the MBR... however instead of moving data, I listed the partition out of order. The first partition went from sectors 500000-600000 (not actual sector numbers, just an example), the second partition went from 400000-500000, and the third partition went from 0-400000 (Kali Linux)
  4. I flagged the third partition as bootable

Now when I restarted my Mac with the flash drive in (holding down Option) I saw the drive! Although for some reason it said "Windows" instead of "Generic USB" or anything... Weird. But I didn't question it. I clicked on the drive and was shivering with excitement!... Until this:

isolinux.bin missing or corrupt
No bootable device -- insert boot disk and press any key

So close, yet so far :(

1 Answer 1

2

I'm trying out the same thing. I stumbled across tlroche's tutorial that made me think that I was going about it all wrong.

What I got from the tutorial was that I needed my own separate MBR on the disk. GRUB installed there will list the .iso files that I have on that disk. And it's not using dd to install those .iso's. It's simply copying the .iso files themselves.

Selecting them doesn't simply boot them though. It mounts them in a loop. For instance, for an ISO in your home folder try

# mkdir media/my-looped-iso-dir
# mount -o loop ~/iso-to-mount.iso /media/my-looped-iso-dir

Then you can inspect the contents of that .iso in the /media/my-looped-iso-dir directory. So after GRUB2 mounts the live .iso it looks for the files needed to boot - namely the bootable linux kernel (vmlinuz) and the RAMdisk image (initrd.*). These need to be specified in the grub.cfg file which you will have to make up yourself (not as hard as it sounds - examples in link).

Actually, I take that back. Setting up the grub.cfg will be the hardest part. But the example in the link provides a good starting point. There's not much to add, just customize the menu entries for whatever .iso(s) that you want to have available to boot.

Apart from that, you can add whatever you want to the remaining space (partition it or not - up to you). .deb packages would probably be my first choice if I'm using only debian-based distros there - and I'm thinking about having a bootable USB like this that has Kali, Tails, and BunsenLabs (formerly Crunchbang). But binaries, full source, whatever. Go ham. (as an aside, having a populated keypassx database wouldn't be a bad idea)

This is nice too because when I need to upgrade the .iso files, I just take the old one out, and put the new one in. Update the grub.cfg menuentry and you're good to go!

EDIT: I forgot to mention that you'll be partitioning the USB drive and creating a filesystem on there. That filesystem will have to have /boot setup in order to install grub - # grub2-install (again, example in link). Make sure that's flagged as bootable, and you should be good.

Then again, this is all in the link...so just...ya know...read the link!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .