Small Linux Distros For Every Occasion
One of the (very many) areas in which Linux has pulled ahead of the pack is with live, complete Linux distributions on every form of removable media. Tiny Linuxes to full-blow kitchen sink Linuxes boot and run from USB sticks and drives, Compact Flash cards, CDs and DVDs; so they never need to touch the hard drive, or even have a hard drive present. Some of them run entirely in memory. Some are smart enough to use the swap partition on the hard drive, if one is available. There are different ways of preserving data and configurations, the main point being you can still save data and configurations.This presents a wide array of useful possibilities: test new systems before purchase, every computer becomes your personal PC, or today's topic, portable rescue media for all the major platforms: Linux, Unix, Macintosh, and Windows. There are dozens, if not hundreds, of different rescue Linuxes, so we'll take a tour of my favorites.
We all know and love the Debian-based Knoppix. Knoppix supports a vast array of hardware—if something doesn't work under Knoppix, chances are it's not supported in Linux. Knoppix gives you GUI tools for nearly any task you want to perform, and includes applications for every imaginable task. You're not limited to rescue operations, but you get a complete distribution with productivity applications. It is very popular and has excellent community support, including good articles on re-mastering Knoppix to customize it for yourself. Knoppix is for Pentium systems with a lot of RAM, the more the better: 32 MB for text mode, 128 MB and up for KDE.
Start at the Knoppix Wiki, and especially the Cheat Codes. These are boot codes for dealing with funky hardware, or turning on special tasks. For example:
- lang=[two-letter country code]
- toram; this is a nice option for RAM-rich systems. The contents of the CD are copied to your system RAM. This a lot faster than running from the CD, and then you don't need to leave the CD in the drive. You need at least a gigabyte of RAM.
The first keyword is always knoppix, like knoppix desktop=fluxbox toram.
Knoppix also comes in a DVD edition, if the CD version isn't enough for you.
SystemRescueCD is my favorite rescue CD. It's based on Gentoo and contains a stripped-down set of applications for system rescues. So it doesn't include OpenOffice or the Gimp or all of the other productivity applications that Knoppix has. You can get ISOs for x86, Sparc, and PowerPC. The x86 version is a mere 155 MB.
Even better: You can boot and run SystemRescue from a USB stick. Newer systems support booting from USB devices; usually you need to go into the system BIOS to turn this on. It's not completely reliable, however; some systems seem to be allergic to booting from USB devices, so be sure to test it before you need it.
With SystemRescue you can copy files over the network, do serious network troubleshooting, read and write all the major filesystems including NTFS, manage partitions and filesystems, and do secure deletions. SystemRescue comes with my favorite data recovery tool, GNU ddrescue. This is the best utility for grabbing data off a failing hard drive. It is fast for a dd-based command, and smart enough to skip over bad blocks and keep going, looking for good blocks to copy.
The most surefire method I know requires a second local hard drive of equal or greater size; either SATA/PATA or USB. Then boot up SystemRescue and copy the first drive to the second drive. Of course you must replace the drive names in the example with your own drive names:
# ddrescue /dev/sda /dev/sdb
You may copy partitions instead of whole drives. Then run fsck on the second drive to check for and fix errors. Make sure it is not mounted, then run this command:
# fsck /dev/sdb
Add the -a option to tell fsck to automatically fix all errors. Use fsck only on Linux filesystems. For other filesystems you'll need their own native filesystem-consistency-fixing utilities.
Don't confuse GNU ddrescue with dd-rescue. They do the same thing and both do it well, but I think ddrescue is faster and more reliable.
GParted is the best partitioning and filesystem-creation application there is. Put it on a bootable medium and you can manage most Linux, Unix, Mac OS X, or Windows partitions and filesystems. Add the dd-based Clonezilla for cloning, and you have the ultimate power tool for new installations, restores, and replications.Clonezilla is an intelligent partition or disk-cloning program that works on any filesystem, because it operates at the block level. On supported filesystems (which are pretty much the same batch as GParted) it copies only used sectors. On unsupported filesystems it can't tell which ones are used, so it does a block-by-block copy. Either way you get your clones.
Our Excellent Ancestors: Tomsrtbt and SuperRescueCD
Tomsrtbt, "the most GNU/Linux on one floppy disk" was the first bootable live Linux on removable media. After all these years it is still useful. True, most computers these days don't even bother with a floppy drive, but for machines that still have them it's a great rescue diskette. It needs only 8 megabytes of RAM. It comes with everything you need for networking and copying files over the network, which is probably the #1 job for a rescue device. It has filesystem utilities, including Windows filesystems, and basic networking troubleshooting commands, so you can perform a surprising number of tasks from this tiny ancestor of bootable live Linuxes. Tomsrtbt has saved the day for me more times than I can remember.
H. Peter Anvin's SuperRescue CD was the first live Linux CD. Mr. Anvin is the primo bootloader guru, as well as a significant inventor or contributor in a number of projects. Super Rescue CD is based on Red Hat 7.2, so it's of limited usefulness on modern systems. But it's a nice tool for older systems; it only needs 24 megabytes of RAM and it handles older hardware without hassles. If you want X Windows, just type startx at the prompt and you get KDE. It's a funny-looking older KDE, but still the real deal.
SuperRescue CD pioneered on-the-fly compression/decompression, which is how you stuff 1.7 gigabytes of operating system and applications onto a single CD.
Fixing Horked MBRs
When you're multi-booting or installing a new operating system onto a used system, sometimes the MBR (Master Boot Record) gets all messed up, so you need to wipe it out and start over. You can do this with the dd command. Be sure to use your own drive name for the of= value:
# dd if=/dev/zero of=/dev/hda bs=446 count=1
That preserves the partition table. If you also want to zero out the partition table, do this:
# dd if=/dev/zero of=/dev/hda bs=512 count=1