I want to create a Knoppix bootable USB flash drive. I've found instructions about how to do this, but I would like to do it fulfilling the following conditions:
The USB I am planning to use has 8 GB capacity, and Knoppix only needs 700 MB (I'll use the little CD version, not the humongous DVD one). I would like to use as little of the capacity of the USB flash drive (I was planning to use 1 GB for the Knoppix bootable disk and the rest as free space). The remaining free space would be a FAT32 partition, so I can use it as a "regular" USB drive.
I am currently using a Debian PC; I would appreciate instructions on how to do this using Linux, and (optionally) OS X.
After googling a bit more, I found a procedure here that works great. It takes a little time, but it works.
I put here this knowledge, so it is available to anyone that faces this particular issue.
Note: I managed to make this work using Debian Linux. I still have to find out how to make it work on OS X.
Step 0. (The obvious one) Download (or somehow get) the Knoppix CD (or DVD) .iso image you want to copy in your flash drive. I'm using KNOPPIX_V7.2.0CD-2013-06-16-EN.iso
.
Step 1. Install syslinux
:
$ sudo apt-get install syslinux
Step 2. (Clean your USB flash drive) Plug the USB flash drive to your computer. To find out how does the system "recognizes" it, type the following command:
$ fdisk -l
(you may need to switch to the root
user, or use sudo
). The result will be something like this:
Disk /dev/sda: 1500.3 GB
...
Disk /dev/sdb: 7803 MB
241 heads, 62 sectors/track 182401 cylinders
...
Notice that the first entry refers to the local hard drive and the second refers to the USB flash drive. Your results may be different. If you have any doubt, unplug your USB, run fdisk -l
again and check which drive is gone.
Once you are sure you know which device is your USB flash drive (in my case /dev/sdb
), take note of the heads
and sectors/track
values (in my case, 241 heads and 62 sectors / track).
Now, shred the flashdrive:
$ shred -n 0 -z /dev/sdb
This command will overwrite your USB flash drive with zeros, including the partition table (check the shred man page for more info). If you want to view the progress, add the -v
switch. This will take quite a long time (30 or 45 minutes in my case), so maybe it's time to go for a snack ;) ).
Step 3. (Prepare the .iso
file) Navigate to the folder where the Knoppix .iso
image is, and convert it to "hybrid mode". Use the values of heads
and cylinders/track
you got in step 1 (if you don't remember them, use fdisk -l /dev/sdb
):
$ isohybrid -o 1 -h 241 -s 62 -e 1 KNOPPIX_V7.2.0CD-2013-06-16-EN.iso
Step 4. Write the image to your USB flash drive:
$ cat KNOPPIX_V7.2.0CD-2013-06-16-EN.iso > /dev/sdb
This will take about 20 minutes (so maybe you should get a cup of coffee right now).
After this command executes, check the USB partition table:
$ fdisk -l /dev/sdb
Disk /dev/sdb: 7803 MB
241 heads, 62 sectors/track 182401 cylinders
...
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 97 724686+ 17 HPFS/NTFS hidden
This tells you that the /dev/sdb1
partition is a bootable HPFS/NTFS
partition. Here is where your Knoppix boot drive is.
Step 5. (Make the rest of your USB flash drive available for use). If you don't mind that the remaining space in your flash drive is wasted, then skip this. But if you (like me) are greedy about these precious extra MB, you'll need to add a second partition to your drive. So, let's edit the partition table:
$ fdisk /dev/sdb
command (m for help): p
Disk /dev/sdb: 7803 MB
241 heads, 62 sectors/track 182401 cylinders
...
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 97 724686+ 17 HPFS/NTFS hidden
command (m for help): n
Partition type:
p primary
e extended
Select: p
Partition number (1-4, default 2): 2
First sector (98-1019, default 98):
Using default value 98
Last sector, +sectors or +size{K,M,G} (8032256-31266815, default 31266815):
Using default value 31266815
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): c
Changed system type of partition 2 to c (W95 FAT32 (LBA))
command (m for help): w
Notice that there are now two devices: /dev/sdb1
, which holds the Knoppix bootable image, and /dev/sdb2
which is free space (almost) ready to use. All that remains now is to make the file system ready:
$ mkfs.vfat /dev/sdb2
And that's it! The next time you plug this USB flash drive to your computer, you'll be able to use the free space as a regular USB flash drive, but there will be a Knoppix Live partition hidden, ready to help you. To use it, just shut down your computer, plug the flash drive to it, and turn it on. Be sure your computer can boot from USB, and wait for the system to start.
I really hope this helps.