Boot Diskettes, Bootable USB Keys and Live CDs

Iowa State University

Office of Academic Information Technologies

	Sooner or later it will happen: a Linux machine will refuse to boot, and all of your files will be lost...or will they? With the right tools, you can repair the problem and/or copy the files to a networked machine even when it won't start. For this purpose we use various forms of bootable removable “disk”, including floppies, CDs and the new USB memory disks. These tools are not only good for disaster recovery, they'll let you have a Linux desktop anywhere you can boot a disk, and are great for showing others how cool Linux can be.
	Earlier versions of Red Hat asked if you wanted to make a boot diskette. If your hard disk's boot loader or its configuration files get damaged, you can still start Linux by booting from a kernel on the boot diskette. It will then mount the hard disk and use the system files on the hard disk to get the rest of the way. From there you can check the grub.conf or lilo.conf file, redo the boot loader, and with luck everything will be OK. Unfortunately, unless you compile a custom kernel with lots of "useless" modules left out, Linux won't fit on a 1.44 MB floppy any more. (If you have an IBM with a 2.88 MB floppy drive or are good at compiling custom kernels, you can still use this.)
	If you're really, really ingenious you can get a minimally-useful Linux distribution on a floppy disk (or more often, a couple of disks). This will give you enough tools to start up the machine, run fsck on the hard disk, and check configuration files to make sure things are still OK. Be sure before you run fsck that the distribution supports the file system on your hard disk; older floppy distros don't always support ext3, and will think the disk is a damaged ext2 drive. Running fsck under those circumstances will make sure there's something wrong with the disk (even if there wasn't before...)
	Floppy distros work just like a big Linux, except that you'll be stuck with a text console, and many of the commands will have fewer options. Your favorite editor won't be there, usually just nano, and you may have to use the insmod command to load modules for your Ethernet/wireless card and the filesystem for your hard disk. (We told you all those text-mode configuration commands would be useful someday.) Nevertheless, floppy distros can be useful for data recovery. The Trinux website includes instructions for recovering files from NTFS volumes using Trinux; look under “War Stories”.
	First, not all machines have floppy drives anymore. Second, the Linux distro you can cram on a floppy is just too small – or old -- to be comfortable. The next step up is the bootable business card (BBC). A business-card-sized CD costs about 50 cents blank and fits in your wallet, which means your recovery tools can always be with you. A BBC has room for a bigger kernel and more software, and often includes X (so you don't have to suffer the text console).
	LNX-BBC was one of the first BBCs, and spawned the Linuxcard Bootable Toolbox. If you're going to be working on a Windows machine, you might want to use INSERT; it can actually write on NTFS volumes (mostly) safely. All of these distros not only include tools for recovering and repairing hard disks, but software for scanning networks and testing network security.
	Many new PCs can boot from a disk on the USB port. This gives you the ability to carry a mostly-complete Linux distro on a keychain drive. Since the /var and /home directories are on the USB disk you can actually save documents and settings between sessions. Damn Small Linux and Feather Linux are two examples. (DSL will also fit on a BBC.) In addition to admin and network tools, they include a small office suite and Web browser so you can do useful work on any machine. Besides, it just seems really appropriate to carry Linux on your (USB-compatible) Swiss army knife.
	Several years ago, Klaus Knopper figured out that if a machine had enough RAM, you could unpack the parts of Debian GNU/Linux that had to be changed into a RAM disk, run the rest of the distro from a compressed disk image on a CD, and still have enough RAM left over to actually run programs. He modestly called his CD Knoppix, and it has led to a wide variety of LiveCDs serving many purposes. In addition to their use in adminstration and security, LiveCDs are handy for demonstrating Linux to people who don't want to install it on their computers. Just boot from the CD and you have a full Linux distribution to work with, even on a machine without a hard disk. And since all the software on the CD is free, you can give copies away to anyone who'll take one.
	The Ubuntu Linux group has created a very good Linux distribution based on Debian unstable. This is also available as a LiveCD, and also a LiveDVD which can either be used to run Ubuntu or install it. Since KNOPPIX and Ubuntu are based on Debian, you won't find the Red Hat tools we RHEL users are used to, so you may have to fall back to the command-line tools we learned in the Basic Unix 1 and 2 classes. If you would rather stick with a Red Hat environment, try the Adios Live CD instead; it's based on Fedora and has all the system-config-* tools where you expect them to be. It can also install some or all of its files to a hard disk, making it an easy way to distribute Linux. (Unfortunately, it's not updated as often as KNOPPIX is.)
	To use a LiveCD for disaster recovery, boot the machine from the CD. This may take some fussing at startup time; you may have to invoke the BIOS boot menu, and may need the BIOS password (if one's been set). Once you've started up, log in as root. Some LiveCDs need a password, some don't; check with the distributor. Once you've logged in, start a root shell (most GUI's will have it in a menu somewhere). Look at /etc/fstab or use the fdisk command to look at the drives on the system. The “p” command will display the partition table; “q” will get you out of fdisk. Don't use any other commands, or you can seriously toast the hard disk partitions!
	To repair a hard disk partition, first make sure it's not already mounted. (Some LiveCDs mount all the available partitions automatically.) Then use the fsck command to repair the drive. If the disk has been behaving especially flaky, or if the -fv option can't repair the damage, it may be necessary to check for bad sectors with fsck -ckv. Bear in mind that this option simply marks sectors as bad; it makes no attempt to recover data in those sectors, so this is a last resort and you may need to reinstall Linux and/or recover data from backups if your drive is going south on you. (You'll also want to consider purchasing a new drive.)
	KNOPPIX, in particular, does nothing to the hard disk; it doesn't mount any hard disk partitions. (It does go through and enumerate the partitions and creates /etc/fstab entries and mount points in /mnt for them, but it's up to you to mount them.) That means you'll have to mount the hard disk by hand if you want to write on it. Remember that a disk can be mounted anywhere in the directory tree, not just in the /mnt directory (though that's the most common place for hard disks). Some LiveCDs will create desktop icons for the unmounted partitions; you can click on them to mount the disk and open a window.
	Here are a few examples of special-purpose LiveCD distributions. Some are serious (like GIS Knoppix), some are trivial (like Games Knoppix). More are listed at the KNOPPIX and Morphix websites. Puppy Linux is a very interesting LiveCD that allows you to start from the CD, work in Linux, and then save the documents and settings you've changed back to a multisession CD, if you're using a compatible drive. When started from a CD, everything is loaded into RAM; once the desktop is displayed, the CD can be removed. It's a great choice for laptops, as battery life is greatly extended when you never spin the drives.

Last updated November 7, 2005 by jbalvanz

Boot Disks and CDs	Page 4

2005-02-17T15:19:03