Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




4.4. Preparing Files for USB Memory Stick Booting

For preparing the USB stick you will need a system where GNU/Linux is already running and where USB is supported. You should ensure that the usb-storage kernel module is loaded (modprobe usb-storage) and try to find out which SCSI device the USB stick has been mapped to (in this example /dev/sda is used). To write to your stick, you will probably have to turn off its write protection switch.

Note, that the USB stick should be at least 128 MB in size (smaller setups are possible if you follow Section 4.4.2, “Copying the files — the flexible way”).

4.4.1. Copying the files — the easy way

There is an all-in-one file hd-media/boot.img.gz which contains all the installer files (including the kernel) as well as SYSLINUX and its configuration file. You only have to extract it directly to your USB stick:

# zcat boot.img.gz > /dev/sda


Using this method will destroy anything already on the device. Make sure that you use the correct device name for your USB stick.

After that, mount the USB memory stick (mount /dev/sda /mnt), which will now have a FAT filesystem on it, and copy a Debian netinst or businesscard ISO image to it. Please note that the file name must end in .iso. Unmount the stick (umount /mnt) and you are done.

4.4.2. Copying the files — the flexible way

If you like more flexibility or just want to know what's going on, you should use the following method to put the files on your stick. USB stick partitioning on Intel x86

We will show how to setup the memory stick to use the first partition, instead of the entire device.


Since most USB sticks come pre-configured with a single FAT16 partition, you probably won't have to repartition or reformat the stick. If you have to do that anyway, use cfdisk or any other partitioning tool for creating a FAT16 partition and then create the filesystem using:

# mkdosfs /dev/sda1

Take care that you use the correct device name for your USB stick. The mkdosfs command is contained in the dosfstools Debian package.

In order to start the kernel after booting from the USB stick, we will put a boot loader on the stick. Although any boot loader (e.g. LILO) should work, it's convenient to use SYSLINUX, since it uses a FAT16 partition and can be reconfigured by just editing a text file. Any operating system which supports the FAT file system can be used to make changes to the configuration of the boot loader.

To put SYSLINUX on the FAT16 partition on your USB stick, install the syslinux and mtools packages on your system, and do:

# syslinux /dev/sda1

Again, take care that you use the correct device name. The partition must not be mounted when starting SYSLINUX. This procedure writes a boot sector to the partition and creates the file ldlinux.sys which contains the boot loader code.

Mount the partition (mount /dev/sda1 /mnt) and copy the following files from the Debian archives to the stick:

  • vmlinuz (kernel binary)

  • initrd.gz (initial ramdisk image)

  • syslinux.cfg (SYSLINUX configuration file)

  • Optional kernel modules

If you want to rename the files, please note that SYSLINUX can only process DOS (8.3) file names.

The syslinux.cfg configuration file should contain the following two lines:

default vmlinuz
append initrd=initrd.gz ramdisk_size=12000 root=/dev/ram rw

Please note that the ramdisk_size parameter may need to be increased, depending on the image you are booting. If the boot fails, you can try adding devfs=mount,dall to the “append” line. Adding an ISO image

Now you should put any Debian ISO image (businesscard, netinst or even a full one) onto your stick (if it fits). The file name of such an image must end in .iso.

If you want to install over the network, without using an ISO image, you will of course skip the previous step. Moreover you will have to use the initial ramdisk from the netboot directory instead of the one from hd-media, because hd-media/initrd.gz does not have network support.

When you are done, unmount the USB memory stick (umount /mnt) and activate its write protection switch. Booting the USB stick


If your system refuses to boot from the memory stick, the stick may contain an invalid master boot record (MBR). To fix this, use the install-mbr command from the package mbr:

# install-mbr /dev/sda

  Published under the terms of the GNU General Public License Design by Interspire