Boot Diskettes, Bootable USB Keys and Live CDs Iowa State University Office of Academic Information Technologies

Boot Diskettes, Bootable USB Sooner or later it will happen: a machine will refuse to boot, and all of your files will be Keys and Live CDs lost...or will they? With the right tools, you can Used when the computer can't start for repair the problem and/or copy the files to a some reason, as a diagnostic, repair networked machine even when it won't start. For and recovery tool. this purpose we use various forms of bootable removable “disk”, including floppies, CDs and the • Boot diskettes new USB memory disks. These tools are not only • Floppy-based Linux distributions good for disaster recovery, they'll let you have a • Bootable business cards Linux desktop anywhere you can boot a disk, and • USB keydisks are great for showing others how cool Linux can • LiveCD distros be.

Earlier versions of Red Hat asked if you wanted Boot diskette to make a boot diskette. If your hard disk's boot loader or its configuration files get damaged, you ● Created during Red Hat installation, or later using can still start Linux by from a kernel on the commands fdformat /dev/fd0 the boot diskette. It will then mount the hard disk /sbin/mkbootdisk kernel and use the system files on the hard disk to get the rest of the way. From there you can check the where “kernel” is the name of the kernel file to be grub.conf or lilo.conf file, redo the boot loader, and used with luck everything will be OK. Unfortunately, ● Starts machine from kernel on diskette, uses other unless you compile a custom kernel with lots of OS files from hard drive "useless" modules left out, Linux won't fit on a ● Stock Linux 2.6 kernels won't fit on 1.44 MB 1.44 MB floppy any more. (If you have an IBM floppies 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 Floppy-based distributions minimally-useful on a (or more often, a couple of disks). This will ● Small Linux distributions designed to boot and run from one or more floppy disks give you enough tools to start up the machine, run fsck on the hard disk, and check configuration files ● Used for recovery when the hard disk is unbootable and/or the system files are to make sure things are still OK. Be sure before corrupted you run fsck that the distribution supports the file ● Usually very basic toolsets; check to make system on your hard disk; older floppy distros sure your hard disk's and your don't always support ext3, and will think the disk favorite are supported (problem is a damaged ext2 drive. Running fsck under those for ext3 disks) circumstances will make sure there's something ● Can usually run fsck, make a network wrong with the disk (even if there wasn't before...) connection, copy files to a server, edit configuration files Boot Disks and CDs Page 2

Floppy distros work just like a big Linux, except Floppy-based distros that you'll be stuck with a text console, and many of the commands will have fewer options. Your ● http://www.toms.net/rb/ favorite editor won't be there, usually just nano, and you may have to use the command ● Trinux http://trinux.sourceforge.net insmod to load modules for your Ethernet/wireless card Most floppy-based distros can connect and the filesystem for your hard disk. (We told to the Internet, and can also read and you all those text-mode configuration commands sometimes write FAT and NTFS drives would be useful someday.) Nevertheless, floppy as well, making them useful for distros can be useful for recovery. The recovery of Windows machines, too. Trinux website includes instructions for recovering files from NTFS volumes using Trinux; look under “War Stories”.

First, not all machines have floppy drives Bootable Business Cards anymore. Second, the Linux distro you can cram on a floppy is just too small – or old -- to be ● Linux distributions that can boot and comfortable. The next step up is the bootable run from a business-card sized CD. business card (BBC). A business-card-sized CD costs about 50 cents blank and fits in your wallet, ● Machine must be able to boot from a CD (including non-round, if you're which means your recovery tools can always be using a real BBC; not all CD drives like with you. A BBC has room for a bigger kernel non-round disks) and more software, and often includes X (so you don't have to suffer the text console). ● Provides a wider variety of tools for repair and recovery, since the BBC has 50 MB of space

LNX-BBC was one of the first BBCs, and BBC Distributions spawned the Linuxcard Bootable Toolbox. If you're going to be working on a Windows ● LNX-BBC http://www.lnx-bbc.org machine, you might want to use INSERT; it can ● INSERT (Inside Security Rescue Toolkit) actually write on NTFS volumes (mostly) safely. http://www.inside-security.de/insert_en.html All of these distros not only include tools for recovering and repairing hard disks, but software – read/write support for NTFS volumes for scanning networks and testing network ● Bootable Toolbox security. http://public.planetmirror.com/pub/lbt/

http://www.damnsmalllinux.org Boot Disks and CDs Page 3

Many new PCs can boot from a disk on the USB Bootable USB Disks port. This gives you the ability to carry a mostly- complete Linux distro on a keychain drive. Since Allow you to boot a functional Linux distro the /var and /home directories are on the USB from a USB “keydisk” disk you can actually save documents and settings between sessions. Damn Small Linux ● Damn Small Linux and are two examples. (DSL will http://www.damnsmalllinux.org also fit on a BBC.) In addition to admin and ● Feather Linux network tools, they include a small office suite http://featherlinux.berlios.de/ and 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 LiveCD Distributions if a machine had enough RAM, you could unpack

● Bootable CD containing a full feature-packed the parts of GNU/Linux that had to be distribution of Linux changed into a RAM disk, run the rest of the distro from a compressed on a CD, ● Configuration files in RAMdisk, applications and utilities run from compressed drive on and still have enough RAM left over to actually CD run programs. He modestly called his CD

● Requires lots of RAM in machine (usually , and it has led to a wide variety of 128 MB min.) LiveCDs serving many purposes. In addition to their use in adminstration and security, LiveCDs ● Most LiveCDs are based on the Debian distribution, which won't have the redhat- are handy for demonstrating Linux to people who config-* tools. don't want to install it on their computers. Just

● You must (usually) mount the hard disk boot from the CD and you have a full Linux manually. 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. Boot Disks and CDs Page 4

The Linux group has created a very good LiveCD Distros Linux distribution based on Debian unstable. ● KNOPPIX This is also available as a LiveCD, and also a http://www.knopper.net/knoppix/index-en.html LiveDVD which can either be used to run Ubuntu – Based on Debian GNU/Linux or install it. – Most LiveCD distros are based on KNOPPIX ● Ubuntu Since KNOPPIX and Ubuntu are based on http://www.ubuntulinux.org Debian, you won't find the Red Hat tools we – A cutting-edge distro with LiveCD based on Debian RHEL users are used to, so you may have to fall unstable back to the command-line tools we learned in the ● Adios Live CD Basic 1 and 2 classes. If you would rather http://dc.qut.edu.au/adios/adios-bootcd.html stick with a Red Hat environment, try the Adios – Based on Fedora Core 3 (for Red Hat fans) Live CD instead; it's based on Fedora and has all – Can drop some of its files on FAT hard disks or resize NTFS volumes and install 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 Using a LiveCD machine from the CD. This may take some fussing at startup time; you may have to invoke ● Start from CD the BIOS boot menu, and may need the BIOS password (if one's been set). Once you've started ● Log in as root, or start a root up, log in as root. Some LiveCDs need a ● Examine /etc/fstab, or use fdisk to password, some don't; check with the distributor. determine partitions Once you've logged in, start a root shell (most /sbin/fdisk /dev/hda GUI's will have it in a menu somewhere). Look (IDE disks) at /etc/fstab or use the fdisk command to look at /sbin/fdisk /dev/sda the drives on the system. The “p” command will (SCSI disks) 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 Repairing the Hard Disk not already mounted. (Some LiveCDs mount all the available partitions automatically.) Then use ● Make sure the partition is not mounted the fsck command to repair the drive. If the umount /dev/hda1 disk has been behaving especially flaky, or if the -fv option can't repair the damage, it may be ● Repair the disk necessary to check for bad sectors with fsck fsck -fv /dev/hda1 -ckv. Bear in mind that this option simply ● If you suspect bad sectors, use marks sectors as bad; it makes no attempt to fsck -ckv /dev/hda1 recover data in those sectors, so this is a last This will take longer, but will use resort and you may need to reinstall Linux and/or badblocks to check for bad sectors. recover data from backups if your drive is going south on you. (You'll also want to consider purchasing a new drive.) Boot Disks and CDs Page 5

KNOPPIX, in particular, does nothing to the hard Mounting the hard disk disk; it doesn't mount any hard disk partitions. (It does go through and enumerate the partitions ● Create a mount point and creates /etc/fstab entries and mount points mkdir /mnt/part1 in /mnt for them, but it's up to you to mount them.) That means you'll have to mount the hard (Note: doesn't have to be under /mnt, some disk by hand if you want to write on it. LiveCDs discourage using /mnt.) Remember that a disk can be mounted anywhere ● Mount the partition at that point in the tree, not just in the /mnt directory mount -t auto /dev/hda1 /mnt/part1 (though that's the most common place for hard disks). ● Use normal tools to examine and modify files on /mnt/part1 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 Special-purpose LiveCDs LiveCD distributions. Some are serious (like GIS ● GIS Knoppix Knoppix), some are trivial (like Games Knoppix). http://www.sourcepole.com/sources More are listed at the KNOPPIX and Morphix /software/gis-knoppix/ websites. – Loaded with GIS software ● Games Knoppix is a very interesting LiveCD that http://games-knoppix.unix-ag.uni-kl.de/ allows you to start from the CD, work in Linux, – Loaded with many games, supports hardware- and then save the documents and settings you've accelerated video cards changed back to a multisession CD, if you're ● Puppy Linux using a compatible drive. When started from a http://www.puppylinux.org/ CD, everything is loaded into RAM; once the – Run from CD-R, CD can be removed desktop is displayed, the CD can be removed. It's – Run from rewriteable drive, files and settings stored on disk (including CD-R, CD-RW and DVD-RW) a great choice for laptops, as battery life is greatly extended when you never spin the drives.

Last updated November 7, 2005 by jbalvanz