Prepping a 128 MB USB Thumb Drive to Install Debian Linux

Some months ago, I upgraded my main workstation. I had reached the point where if I was going to upgrade one component, I had to upgrade them all. This left me with my current new machine and my old machine which was fairly complete and still reasonably powerful. Rather than have a completely assembled computer gather dust in the corner, I decided that I needed to install some kind of operating system. I chose Linux because it was freely available and, well, I like a challenge.

My only problem was that my DVD-ROM drive gave up the ghost long ago and I didn’t have a spare to replace it. It occurred to me that since my old computer supported booting from a USB device that I should be able to get the computer booted and the install process started.

This worked out so much better in my head.

I found several guides on how to create a thumb drive capable of booting, but the problem is they all require you to already have Linux installed in some fashion before you can do it, which I didn’t.

I was moderately successful with installing DSL to a thumb drive, which was neat, but that’s not what I really wanted.

I eventually settled on Debian Linux. I had used Debian for years to power this site before I switched to dedicated hosting this summer, and quite liked it. Also, it was the only distribution that I could get to work with this method.

Installing Debian Linux From a 128MB USB Drive

What you will need:

  • 1 128MB USB Drive (although if you use something bigger you will have more options)
  • 1 Debian install image
  • boot.img.gz
  • 1 Knoppix disc

Downloading the software

For this method, you will need to put some files on your thumb drive to not only start the computer, but to initiate the install process. Debian’s install manual tells you that you will need to download “hd-media/boot.img.gz”, but doesn’t tell you where to get it. I was able to find that file here,
and it will be in a similar location on your favorite mirror. You’re also going to want to download an install image so your computer will have something to do when you start it up. Since I’m working with a 128MB drive, I decided to go with the Business Card .iso. It weighs in at about 40MB and is just big enough kick off the install. If your drive is bigger, you might want to consider going with the Network Install, but it’s not strictly necessary. I saved these in the root directory of my hard drive, to make them easier to find. Both images can be found here.

Next we need a Linux environment to prepare the USB drive. I decided to go with Knoppix for this, primarily because I had already created a Knoppix CD recently to check my laptop’s Linux compatibility (but that’s another article).

Next, put the Knoppix CD in the CD/DVD drive of your computer and reboot. When the Knoppix boot menu appears, type in “knoppix 2″ so we boot into text mode. No sense in loading the entire disc when we just need the text interface.

boot: knoppix 2

Once the boot process has finished and your USB drive is plugged in, you should now find that a mount point has been created for your drive under “/mnt”

cd /mnt
ls

The drives that Knoppix has detected and set up will be listed here. I am using serial-ATA on the machine that I was using to prep the drive, and that showed up as /mnt/sda1 while the USB drive showed up as /mnt/sdb. It is VERY IMPORTANT that you know which drive is your USB drive and which drive is your data drive. A quick test by removing the USB drive showed that /mnt/sdb disappeared, and reinserting it caused it to come back.

Next we need to mount our existing hard drive onto our file system. Replace “sda1″ with whatever your hard drive was detected as.

mount sda1

This will put your existing hard drive in the directory structure. Now we need to navigate to our downloaded images. You will need to change this path to wherever you stored the images.

cd sda1/debian

Now install the boot.img.gz file. It is VERY IMPORTANT that you replace “sdb” with whatever Knoppix detected your USB drive as. This will IRREVOCABLY ERASE EVERYTHING on the target drive. Double check it, and then check it again.

zcat boot.img.gz > /dev/sdb

This could take several minutes. I was given an error that there was not enough free space on the device. I ignored it, and suffered no ill effects.

Once that process is completed, we need to mount the USB drive into the filesystem, substituting the device for your thumb drive for “sdb”.

mount /mnt/sdb

Then copy your install image to the drive.

cp debian-31r4-i386-businesscard.iso /mnt/sdb/

Once that’s complete, unmount the USB drive before removing it from the system.

umount /mnt/sdb

You have now prepared a portable, bootable, Debian Linux Installer that you can wear around your neck.

To restart your Knoppix system just type in ‘reboot’, remove the CD when prompted, and hit Enter when prompted.

reboot

Now put your USB drive in the computer you want to install Debian on. Make sure you set in the BIOS that you want to boot from your USB device. Some motherboards (mine included) won’t boot from the USB drive unless you also turn on ‘USB Keyboard Support’, so ensure that’s turned on as well. Once you’ve verified that the settings are correct, reboot and you should be greeted with the Debian installer. Unfortunately, going through the install process is beyond the scope of this article. If you need help with that, I would suggest looking at the Install Manual or nosing around in the forums.