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:
- I shredded the flash drive to rip out the MBR, partitions, etc
- I copied the
.iso
over (usingdd
) so it functioned like a normal 4 GB Kali Linux drive - 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) - 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 :(