Booting KANOTIX from a USB-Stick
I wanted to boot my new KANOTIX versions from a USB stick and furthermore, to save my data on the USB stick (also under Windows). However, I wanted to change as little as possible from the CD version. Since this might interest other Linux fans, you will find below a short description of the variant I run:
Caution with the drive designation!
My computer mounts the USB stick as /dev/sda1 under /media/sda1, when the stick is put in before booting (test in root terminal with the "mount" command). This will possibly be different on other computers (/dev/sdb1, /dev/sdc1), if a SCSI drive is present.
Use extreme caution when partitioning and formatting the drive, to use the right one
. Current data on the partition will be irremediably lost. I also give no guarantee as for the accuracy of the the actions described here. There is a risk involved in everything we do.
- BIOS must allow USB booting. Most computers offer a menu selection, which includes USB stick, by pressing the <F8>, <F11>, <F12> or other function key at boot.
- USB stick with at least 1 GByte memory
Procedure: (All commands must be typed from a root terminal.)
Partitioning the USB stick:
- use only a primary partition with "fdisk /dev/sda2?"
- type of partition "C" W95 FAT32 LBA)
- delete any existing partitions before creating
- format the USB-Stick with vfat: "mkfs.vfat /dev/sda1"
Copy the KANOTIX CD onto the USB stick
- first copy the /boot directory from the CD: "cp -Rvf /media/cdrom1?/boot /media/sda1/" (otherwise, the sectors are outside the bootable range of my computer's BIOS)
- then the rest and install the GRUB bootloader on the USB stick:
cp -vf /mnt/cdrom1/* /media/sda1
cp -Rvf /mnt/cdrom1/KNOPPIX /media/sda1/
grub-install --root-directory=/media/sda1 /dev/sda
Customize the GRUB menu to be able to start automatically from the USB stick:
Add the following lines or change accordingly:
#line 7, manual modification for usb stick boot
#line 39, manually added for usb stick boot
title ACPI on - DMA on - English for usb-stick boot
kernel (hd0,0)/boot/vmlinuz ramdisk_size=100000 init=/etc/init lang=us \
apm=power-off nomce quiet bootusb2 fromhd=/dev/sda1
[Changes concerning additional kernel parameter: "bootusb2 fromhd=/dev/sda1" to load instead the USB kernel module together with the boot device and including and GRUB device designation (hd0,0) instead (CD).
For testing purpose you can make the changes at boot using the GRUB command line. Possibly the English key layout is active, so here are the most important keys :
<'> corresponds to <=>, <-> corresponds to </>, <(> corresponds to <*>]
Reference for the drive notation from GRUB designation for the USB stick partition (on my computer) (hd0,0):
In the GRUB command line mode, the drive designation can be found, for example, with the "find" command.
At the USB Stick boot (possibly with <F8> key), leave the GRUB graphic mode (with the <ESC>-key)
In GRUB Text Mode, type "c" to get a command line
Find and display all partitions containing the filename "vmlinuz" with "find /boot/vmlinuz"
(on my computer (hd0,0) for the USB Stick and more
(hd1,3)... for other Linux Installation on the hard drive).
Get back to the Text or Graphic mode with <ESC>
And soon it is ready to go:
Put the USB stick in,
when the BIOS boots up use the <F8> function key to display all boot devices,
select USB stick as boot device and
finish loading the operating system.
Alternative method using the complete ISO image on the USB stick
With the previous method, you don't get to keep the ISO image, unfortunately, so you can't be able to burn it later on CD. Consequently, here is another easily modified way, in which the complete ISO image is copied on the USB stick.
Partition and format the USB Stick as explained above.
Copy the boot directory:
The ISO image must be mounted on that directory over the Loop device:
mount -o loop -t iso9660 /Path_to_ISO-Image/KANOTIX.iso /media/test
cp -vR /media/test/boot /media/sda1/
Copy the ISO image onto the USB stick. (This time, it's not the content of the CD you will copy, but the complete ISO image itself instead.)
cp -v /Path_to_ISO-Image/KANOTIX-BUG-HUNTER-X-2004.iso /media/sda1
Install the GRUB bootloader on the USB Stick (as described above)
Edit the GRUB menu (same as above) -
/boot/grub/menu.lst" and add the following lines or change them accordingly:
#line 7, manual modification for usb stick boot
#line 39, manual addition for usb stick boot
title ACPI on - DMA on - English for usb stick boot
kernel (!hd0,0)/boot/vmlinuz ramdisk_size=100000 init=/etc/init lang=us \
apm=power-off nomce quiet bootusb2 fromhd=/dev/!sda1 fromiso=/*.iso
(only the kernel parameter "fromiso=/*.iso" was added)
And we're in business again! Reboot from the USB stick....
All of the present Wiki page have been written from my system booted directly from the USB stick. Owing to the internet connection over a DSL router with DHCP/IP assignment, I need no further configuration to get to the internet.
I would be grateful to get feedback about how clear is the explanation, about errors or alternative configuration.