Booting Linux from a USB Stick using a Floppy
The trusty old Fujis that make up the bulk of the computers I deal with day-to-day tend to be pretty reliable, but I have noticed a few going down with (what I believe are) faulty disk drive controllers (to be fair, these machines are at least six years old). The system runs fine, all except seeing a hard drive.
I’d obviously heard of running a computer from a solid state disk of some sort, it’s not new. The Raspberry Pi runs off of an SD card and I’ve seen a few projects using Compact Flash. So rather than bin another machine, I thought I would experiment to see if I could get Linux to run from an old USB flash drive I have lying around (Windows was pushing it on size if nothing else).
At first I looked for a lightweight distro, something close enough to Windows in look that, should I put it in front of one of my users, it wouldn’t freak them out. Precise Puppy seemed to be the answer.
Once loaded it runs from RAM, which made it responsive, but the design was a bit hard on the eye and to save any changes permanently you had to remember to click a button to write to the USB stick, which was a slow and tedious process. It also seemed to asked me to confirm some settings every time it started, not great when a machine rebooted, I could already hear the support calls. The final straw was the difficulty in getting an RDP client working.
I went back to a distro I knew a bit better and which looked easier on the eye: Linux Mint.
To be honest, once I’d decided on Mint, I didn’t do anything particularly special, just picked the USB drive as the installation drive after booting from a Live CD/DVD. It took a bit of time, but once it was installed it ran from there without needing to do anything else.
I decided on a 4GB drive as 2GB was a little tight should you want to install anything else (and Mint isn’t the slimmest by default, it isn’t designed to be).
You could also install it using something like UNetBootin I assume.
The only slight issue is on boot you get an error saying hd0 is out of space and you have to press a key to continue, whether it does or not has been a bit random, but a reboot usually sorts it out.
Booting from USB without BIOS support
So I had a bootable USB stick with an OS on it. The problem was that the machines we use are old enough not to have the option to boot from USB. To get around this, I decided to make a a bootable floppy that would recognize a USB drive. Plop was the easiest (and one of the few) tool I found to do the job.
You can download it for a number of platforms. I used Windows so I download the latest version (5.0.14 at the time) from the Boot Manager downloads page and unzipped it, then used RawWriteWin (also downloadable from the Plop site) to write the plpbt.img file to the floppy disk I planned to use.
This leaves you with Plop’s standard install, booting to a menu reminiscent of an 80s sci-fi game where you can pick to boot from a range of devices, including USB. That’ll work fine, but if you know you’re only ever going to boot from the stick, then you can tweak the config so it bypasses the menu and boots straight from the USB.
To do this you need to use the plpcfgbt program included in the download. There are various command-line switches, which you can find in the documentation. The easier alternative is to use the plpcfgbtgui program which you can also find in the zip file you downloaded.
Click the button with the ellipsis and find the plpbt.bin file on your floppy, then hit Open. Now click the Hidden USB button at the bottom and then click Configure. Wait until you see a confirmation message and you’re all done.
Now insert the USB drive you installed Linux on, put your newly created floppy in the drive and boot the machine, it should show you the usual Linux bootloader and then away you go.
It’s not the fastest boot in the world, but once it’s up and running I found it ran very well on a P4 with 786Mb of RAM.
Running off of a USB flash drive was actually easier than I thought and, once done, should just truck along. It’s probably not the answer for a long-term setup (USB sticks aren’t designed for high read/write usage), but I could send out a whole OS in the post to a remote site and let them plug it in, something I’d never do with a hard drive.
It’s also portable, so you could carry your own OS with you wherever you went (i.e. if you were staying at a friend’s house). Even just having it at home means you have a separate OS ready to go without disturbing your setup.
As USB drives get faster, they’ll become a viable alternative to a hard drive as well as more expensive solid state disks. I run my Pi off an SD card that cost £5, try finding a hard drive for that.