Damn Small Linux booting on the Sandisk Cruzer Mini
Today was not a good day. My vehicle decided to blip up a "Check Engine" light so I had to take the damn thing to the dealership. I was there forever...
When I got home it was pointless to go into work because there would have been only a couple of hours left in my workday so I stayed home.
So anyway, over this past week I've been trying to get Damn Small Linux (a.k.a. "DSL") to boot from a Sandisk Cruzer Mini 256MB pendrive. "You can boot a whole Linux OS on a 256MB pendrive?" Yes you can. I'm writing this article from it right now. (grin)
You'll note that I said "over this past week" I've been attempting to do this. Each day I would spend some time trying to get it to work, said "..to hell with it, I'll try again tomorrow." Today was the day I got it to work.
Here's how I did it:
Before continuing, I should note that..
- I have a Shuttle AN35/N Ultra motherboard.
- I downloaded and burnt a DSL CD-ROM, which you need.
- Your internet connection when in DSL should be live. Without it, this tutorial won't work.
- If you screw up your computer or pendrive by following anything listed here, that's your fault - not mine. (grin) Don't ever follow my advice. 😉
1) First I had to make sure I could actually boot from the Cruzer.
The easiest way to do this was to use a format utility by HP that allows you to write DOS boot partitions to a pendrive.
I needed a 3.5" floppy so I could copy the DOS boot files from a floppy to the pendrive.
In Windows XP, I grabbed a floppy, right-clicked on it from "My Computer", formatted it as "FAT" and ticked the option to "Create an MS-DOS startup disk". Done deal.
Then I launched the HP Format Utility. I formatted my Cruzer as FAT and ticked the option to copy files from the floppy drive. This partitions the Cruzer, copies the appropriate bootup files and makes it bootable.
In my motherboard settings, I set the first boot device as USB-HDD. USB-FDD and USB-ZIP did not work, but the HDD one did.
Then I rebooted. The pendrive did boot on its own and I got a DOS prompt. I then knew that a) the pendrive would boot and b) it would boot and operating system.
2) Getting DSL on the pendrive and making it boot on its own.
Copying DSL to the pendrive is easy. Making it bootable was the hard part. Here's what I did step by step:
Edit: The striked-out stuff below is the old previous (and incorrect) method. Below the striked stuff is the proper way.
a) I formatted/paritioned the Cruzer like I said above, using FAT and copying over MS-DOS boot files - then left it as is (I later found out this was the only way to get this to work right). Edit: Scratch that remark. Just format pendrive as FAT with no boot files. b) I booted into DSL using the CD-ROM. Once in DSL, I right-clicked the desktop, chose "Apps" then "Tools" then "Install to USB Pendrive". A window comes up, grabs ONE file from ibiblio.org and then asks if you want to continue. I did not continue, I just wanted that one file it grabs, which is frugal_usb.tar.gz.
c) I right-clicked the desktop, chose "XShells" then "Root Access". This puts you in /home/dsl, which is where you want to be.
d) I typed the following commands:
echo "mtools_skip_check=1"> .mtoolsrc
The installation of DSL to the pendrive begins, and shortly ends there after. What it does is that it first goes out to ibiblio.org and grabs the USB boot image. Then it goes to the DSL CD-ROM and copies the KNOPPIX image to the pendrive, along with setting up some other directories.
Are we done yet? Nope. There's a few more things to do.
3) Finalizing the DSL installation on the pendrive.
Once the DSL install to the pendrive was completed, I shut down DSL properly (right-click, choose "Power Down" then "Reboot"), and once the system rebooted and started to load Windows XP I put the pendrive back in.
In XP, I did the following:
a) I used a software called WinImage to "extract" all the files from dsl-0.9.3.iso (including all subdirectories) to the pendrive.
b) I navigated to the "boot/isolinux" directory of the iso file in WinImage and then copied all the files in that directory to the root of the pendrive.
I rebooted, and everything worked.
a) Format the pendrive using the HP Format utility. Format as FAT with no boot files. Then I used SYSLINUX (windows version) to put an ldlinux.sys on the drive (necessary to boot) by running the command syslinux.exe g:. Drive G is my pendrive's drive letter in Windows. Note on SYSLINUX, you have to type syslinux.exe, else it will fail. You also have to make sure you have the right drive letter or your entire Windows installation could get really screwed up.
b) Boot the computer with the DSL CD-ROM and get into DSL. Once inside, right-click the desktop, click "XShells" then "Root Access". I know that my pendrive is labeled as /dev/sda (on other computers it may be different). I launched the command fdisk /dev/sda. Note that I did not type sda1, which would be wrong. Just sda. I changed over the partition ID to FAT16 by doing commands t then 6. Then I press p to view the current partition state. If I don't see an asterisk for "bootable", I press a then p again. If I see the asterisk, I'm good. Then I press w to write the partition to the pendrive.
c) Back into Windows I go. I use WinImage to open up the dsl-0.9.3.iso image. I copy everything from /boot/isolinux to the root of the pendrive. the /KNOPPIX and /lost+found directories I extract as-is.
d) I reboot with the pendrive inserted. Worked.
A few more notes:
I use a Sony SDM-S73 LCD monitor. From prior KNOPPIX booting, the only way to get native resolution on DSL boot was to type fb1280x1024 when DSL first loads (before fluxbox and all that) and choose the "development" X driver. Then I was able to get native resolution for this monitor and everything looked okay.
On my other PC, which is a Dell Dimension 4400, the pendrive will not boot. I don't know why. The BIOS does "see" it, yet it won't boot it. I'll have to mess around with that to see if I can actually get that to work or not. On my Shuttle board however, it does work.
Yeah, I know.. this was a huge long post - but bear in mind I've been trying to get this to work all week.
For those who would ask "Why bother, who cares?", here's why:
The fact that you can boot and entire operating system with NO hard drive and NO cd-rom is positively cool. I now have an entire "backup" OS that never touches my hard drive unless I want it to. As a matter of fact, I will be able to take this to OTHER computers and load my whole OS without rebuilding anything (which takes hours!!)