Wednesday, October 15, 2008

Installing Darned Small Linux Onto Your Boot Drive

Hey there,

When you hear the "brand" name "Damn Small Linux" these days (note the title of this post has been altered slightly to try and be as non-confrontational as possible. We don't need or want any flack from oversensitive web-monitors, and we'll be damned if we won't do everything possible to stay under the radar ;), you generally think of a bootable USB-stick/flash-card installation, or something of that nature. Damn Small Linux (DSL, from here on out, since I can hear the damn hammer falling already ;) was put together, it seems, for just that specific purpose. It's DSL, which is, by definition pretty DS ;)

Today, we're going to walk though installing it on your bootable hard drive. Sure, sure, it defeats the principal of the whole thing, but you can always just slice up two tiny little partitions and have DSL as a backup for your other OS, which may or may not completely self-destruct at any moment. Plus, it's a great idea when all you've got to work with is an old machine that won't run anything else!

You can pick up the latest version of DSL from their main download site. I'd suggest sauntering over into the "current" directory and checking out the ISO's in there (4.2.5, I believe is the newest stable revision available as of this writing). You'll want to grab an ISO file, so you can burn a CD to boot and install from. Once you've done that, you’re good to go (we've just, in theory, skipped step 1. If there's overwhelming interest, we'll write up a post on burning a bootable ISO, but it probably wouldn't play out well since there are so many programs available to do this with. Googling "burn bootable iso YOUR_HARDWARE_OR_OS_OR_CDROM" should probably get you to a set of instructions that will make this part simple). Another important thing to note is that DSL does provide alternative Floppy Disk images, so (if your hardware's old enough, or you just can't boot from CD-ROM) you can go that route, too :)

So here we go, with step 1 (which is really step 2 ;)

1. Boot from your CDROM or floppy drive and begin a crippled-terminal session (same as a regular one after a full install, except you're limited in what you can do) and run the following to gain the required privileges in the system default shell, and get ready to chunk up your disk with "cfdisk":

host # sudo -s
host # cfdisk /dev/sda

We'll assume, for the purposes of this tutorial, that you can wipe out the whole disk, and lay it out as 2 or 3 new partitions. This way, you'll have /dev/sda1, /dev/sda2, etc and things won't get complicated. Obviously, when you do your own setup, things might be slightly different (/dev/hda or you're adding newer partitions and need to start with those - /dev/sda6, etc), but you should be able to apply these same principles all around; just to different HDD device names.

2. Create at least two partitions with "cfdisk," one for the main filesystem (type 83 for ext3) and one for swap (type 82 for standard Linux swap). We'll assume that partition sda1 is going to be your Linux OS partition and partition sda2 will be your swap partition.

3. Now we're going to reboot (after writing our changes to the partition table with "cfdisk") and start up another crippled-terminal session. To prepare for the DSL installation, we need to set up our swap area:

host # sudo -s
host # mkswap /dev/sda2
host # swapon /dev/sda2

4. Next, in the same crippled-terminal session, we'll run the following script:

Host # dsl-hdinstall

You will be prompted to provide the partition onto which you wish to install your DSL Operating System. In our case this would be sda1 (possibly /dev/sda1, etc).

Next, you'll be prompted about whether or not you want to allow multiple logons simultaneously. It's generally safe to say "yes" to this and, really, is a bad idea not to. If you end up in a situation where one session is hung, if you can't login and start another session, it will be a lot harder to kill the initial "hung" session.

Then, you'll be prompted as to whether you'd like to use ext3fs as your file system. Generally, this is what you want. But, since ext3fs makes use of advanced features like journaling, etc, you may want to choose ext2fs, instead, if your machine is older or is low on resources as it is.

Then, just to keep you in check, you'll get the "Windows Treatment." By which we mean, of course, that you'll be asked if you "really" want to do all this stuff (Technically, for it to be a textbook "Windows Treatment," it would have to ask you several more times ;).

The next thing you'll want to do is kick back while DSL loads and installs itself on your hard drive.

Then, this very same script (all-encompassing as it is) will ask you the standard question about which boot loader you would like to install (and where), if you want to install one at all. Generally, we'd pick grub on the MBR, but you can still use LILO and have either installed on a partition boot-block.

Finally, you'll be asked to reboot. Really, you'll be told to reboot. You don't have to, but if you don't, this has all been for nothing. Don't give up now! :)

5. When the script is all done and you're good to go, you'll want to remove the burned CD from your CD-ROM drive and reboot your machine, making sure that it gets booted from the DSL OS partition you just setup.

6. The last thing to do is fairly obvious, but we'll include it for completeness' sake. You'll need to create passwords for the users root and dsl (Actually the dsl password isn't all that obvious, because it generally doesn't exist on any other distro than DSL ;)

And you're all set!

For more reference on using "grub," see our previous post on using grub to change root’s password (which links to a few other posts) and, for help with “cfdisk”, check out “Part 4.0” of this Debian Installation Tutorial which includes lots of great examples and references to other sites (even for “fdisk” if you ever need to use that instead).

Have great Damned day ;)


, Mike

Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.