How To: Boot A Dead PC With Nothing But A Thumb Drive
But with the advent of the tiny, lightweight, and portable USB key drive, system builders now have a new tool. I believe the USB key drive could alter—even usurp—our old rescue and recovery methodologies forever.
The USB key drive—also known as a flash or thumb drive—is most commonly deployed as a storage or backup utility. But with a few simple conversion steps, you can transform any key drive into a full-blown rescue and recovery tool. In this Recipe, I'll take you through those steps. I'll also outline the advantages, and a few disadvantages, of transforming the key drive into a bootable utility.
While there are a couple of software installations involved, both are freeware and easy to deal with. You'll also need another PC along for the ride when actually performing a full rescue and/or extensive data recovery—but more on that later. Also required are any boot floppy images necessary for the recovery process, which we'll also get into more detail about later. Finally, while the examples I provide were done on a Linux box, everything I discuss in this Recipe will work on Windows systems, too.
Ingredients
Here are the essential components you'll need for converting a USB key drive into a bootable utility:
- USB key drive: Any kind or capability will do. In the tests I performed, an older Memorex TD 2B flash device fulfilled the requirement with 128 MB (119 MB formatted) of storage space.
- Recovery Is Possible Linux: This specialized, minimal Linux distribution—best known as RIP Linux—provides recovery tools for both Windows and Linux installations. It can boot into a workable desktop on many types of hardware. I like RIP for its small size (35 MB) and because it contains applications designed for data recovery. RIP Linux weighs in at 72 MB, leaving 47 MB for additional rescue images (that's more than 30 1.44-MB floppies) and run-time storage.
- SYSLINUX binaries and files: SYSLINUX provides a minimal boot loader environment for launching into other rescue, repair, or recovery images, including pared-down Linux or Windows operating systems. I used SYSLINUX to enable an easy-to-use boot menu for booting into any number of floppy-emulation images contained on the USB key drive. In some cases, SYSLINUX must be obtained separately, as not all Linux distributions may contain its files by default.
- USB-compliant BIOS: This simply means the BIOS can recognize and boot from USB key drives. Many modern BIOS makes and models, including Phoenix Award BIOS, are USB-compliant.
- Desired boot floppy images: You'll need any boot floppy images that are necessary for the recovery process, which will be determined on a case-by-case basis. Some vendors still issue rescue/recovery floppy images or driver installers for add-in cards; these make for great inclusions with this USB key drive solution. These images comprise drivers, utilities, and configuration data. It's all compressed into a single 1.44-MB floppy image used to boot a machine into some state to apply changes, updates, or recover a damaged installation.
- An additional working PC: You'll need another (working) PC to create recovery images and modify the USB key drive contents.
Why Choose RIP Linux and SYSLINUX?
There are several compelling reasons why I recommend the RIP Linux rescue system. Here are the ones I consider most compelling:
- Ultra-compact design: Because RIP Linux takes up only 33 MB, it can be used on older 64-MB USB key drives and still leave plenty of headroom.
- Flexible format: Unlike CD and DVD discs, USB key drives use a file system format that Windows and Linux can easily recognize and use without additional hardware or software.
- Scalable structure: Vendor-specific and general-purpose recovery utilities can easily be added to the RIP Linux menu using the SYSLINUX boot loader.
- Current applications: RIP uses current applications, and you can include your own as you see fit.
- Quick build time: Creating the USB version of RIP Linux completes within minutes.
- Easily adapted and modified: SYSLINUX permits easy boot-loading capability for a variety of recovery utilities and applications.
While other software choices exist for this task, I consider these solutions overly complicated. For example, Feather and Damn Small Linux (DSL) are two lightweight (50 MB) live-CD distributions. Both distros are designed to fit on small business-card size CDs for promotions and presentations, and they can be easily modified into a respectable rescue system. But they both lack the specialization you'll find in the equally small RIP Linux.
Here are the three distinct advantages to the USB key method:
- Storage space is writable: You can store data from any computer without specialty hardware and software, unlike a read-only CD-ROM image (or writable CD-ROM image without a CD burner!), and with much greater capacity than a typical floppy.
- Smaller, more compact, and less fragile than CD/DVD: A USB key drives storage medium will never scratch, and it is much more rigid than CD/DVD discs. Finally, USB key drives are tiny yet capacious: the smallest are just a tad over two inches long, yet they can store as much as 2 GB of data.
- Easily expanded, updated and modified for custom use: You can resize, reformat and repopulate any applications, drivers or utilities necessary to recover any PC.
To be fair, there are a few drawbacks to the USB approach. Here are three of the worst problems I've spotted:
- Not all USB devices boot.
- Not all BIOSes boot USB devices.
- Not all USB devices that should boot, will boot.
Also, not all USB storage devices—flash or otherwise—are considered the same for rescue and recovery purposes. For example, among the products I tested, neither the Link Depot SD-to-USB adapter with a 1 GB storage card inside, nor the simple Z-Cyber USB 2.0 iDrive worked as a boot device. The Link Depot adapter was unrecognized by the BIOS during boot-up. And the iDrive prevented the BIOS from proceeding through the power-on, self-test (POST) startup sequence. For a system builder seeking to troubleshoot an existing rescue or recovery problem, either device would only complicate matters.
Another issue: Drive labels for USB devices, which are used to distinguish one storage volume from another, vary from one BIOS manufacturer and version to another. Some popular BIOS versions, such as Phoenix Award, identify the first attached USB device as USB-HDD (hard drive). Others see only USB-FDD (floppy drive) or USB-ZIP (ZIP drive) devices.
If the drive label is unclear for a particular BIOS, even with the key plugged in, try setting the boot priority—and first boot device, if applicable—to any available USB device name. Remember, not all BIOSes support bootable USB devices.
That said, the File Allocation Table 16-bit (FAT16) file system format, originally developed for MS-DOS, is used in this Recipe for compatibility with most BIOS makes and models. This will identify either a bootable USB-HDD or USB-FDD device. It is essential for an all-purpose bootable USB recovery solution.
Other Uses For a Bootable USB Key Drive
With a little research and testing, you'll find your transformed key drive can also perform the following tasks:
- Diagnose disk drives, memory modules, and other hardware.
- Obtain detailed hardware reports.
- Identify and benchmark CPUs.
- Copy partitions to local or network-attached disks.
- Reset Windows or CMOS passwords.
- Run specialized rescue disks.
- Run virus and malware scanners.
Eleven Steps Toward a Bootable USB Key Drive
Let's walk through creating and configuring a USB key drive for use as a computer system recovery solution. Here are the 11 steps:
- Download the SYSLINUX suite from the SYSLINUX Web site.
- Obtain a copy of the RIP Linux ISO distribution. RIP can be downloaded from this Recovery Is Possible Linux rescue system page on Tux.org.
- Open the local ISO image and extract the mkusb.sh script for Linux or mkusb.bat for Windows. (This Recipe uses Linux-specific commands, but the Windows procedure is roughly the same.) Copy the script to a temporary working directory along with the RIP Linux ISO.
- Run the script as depicted in the screenshot below. In a matter of minutes the USB key will receive a fresh Linux installation. Be sure to identify the appropriate USB device label in the BIOS, as the RIP USB scripts will automatically select the first available drive assuming it is the default USB drive entry and proceed to irreparably modify the corresponding partition entry.
- At this point, RIP Linux is ready to operate directly from the USB key. The next screenshot illustrates what's necessary for the initial bootable USB image:
- Included recovery applications are limited to what the RIP distribution provides. Although well populated with a number of handy applications, RIP does not provide vendor-specific diagnostic tools to troubleshoot a misbehaving disk drive for example.
- The next series of steps demonstrates the process of including additional boot images to the USB key.
- Under Linux, the drive partition will be un-mounted—that is, not visible as a world-accessible drive partition. Remount the drive or disconnect and re-plug the USB key to trigger hardware auto-detection facilities to mount the partition.
- Obtain or create the desired boot floppy image(s) (.img or .igz). For example, an image named my-diags.img. Copy this file directly into the main directory on the USB key.
- Open the syslinux.cfg file with your favorite text editor (such as vi, emacs, or joe) and scroll down to the section where the first LINUX (or lowercase linux) directive is issued, as the following screenshot shows.
- For every boot disk image, there is a corresponding SYSLINUX configuration entry. Each entry has the same basic format:
LABEL [entry]
KERNEL [image]
APPEND [value]
- Where [entry] corresponds to the boot-time image entry, [image] refers to the image boot loader, and [value] includes any additional boot-time parameters. Format this accordingly:
LABEL my-diags
KERNEL memdisk
APPEND my-diags.img
- The above entry is formatted using our fictitious example values.
- Copy the memdisk boot image to the USB key. This critical file can be found wherever SYSLINUX sources are installed. On a default Fedora Core installation, this happens to be situated in the /usr/lib/syslinux directory.
- Repeat steps 6 and 7 for additional boot images, which may alternatively end in .igz for a gzip-compressed (.gz) image (.img) file.
- Reboot the computer, and trigger the BIOS setup key. This varies by manufacturer, but is commonly the Delete + Escape + Function keys, or some combination thereof. Once in the BIOS, seek out the boot priority or hard-disk sequence settings, and make the USB key boot first.
- Although the initial RIP image is only 72 MB big, the USB key can quickly grow to several hundred megabytes with the addition of more drivers, images, and tools. The beauty of this is they can all be added while the system is booted to the X Windows desktop from the USB key, which happens to contain the latest version of the Firefox Web browser.
Native Capabilities of RIP Linux
Next, I'll walk you through some of the things RIP Linux is capable of doing by itself without additional packages.
The native RIP image is well-stocked with tools to image, edit, and repair disk or file system partitions, burn CD and DVD media, and even mount remote storage volumes via Secure Shell (SSH) using the SSH userspace file system (SSHFS). RIP supports many bus types including IDE, Serial ATA (SATA), and SCSI for common storage drives and pluggable external devices by way of USB and Firewire.
Here's a summary of RIP applications:
- ClamAV: a free anti-virus program
- SSHFS: secure copying across the network with secure shell (SSH)
- cmospwd: a utility to reset CMOS passwords
- dmidecode: report system hardware as identified by the BIOS
- ddrescue: a specialized disk dumping recovery tool
- ethtool: query and change network card settings
- lshw: list and identify hardware by vendor make and model
- ssh: a secure shell server and client package
- jfs tools: utilities to recover and repair JFS partitions
- xfs tools: utilities to recover and repair XFS partitions
- ntfs tools: utilities to recover and repair NTFS partitions
- chntpw: a specialized application to change NT passwords kept on NTFS
- dirsync: maintain separate but identical archive directories
- testdisk: check and undelete various partition formats
- cfdisk: a minimal but powerful disk formatting utility
- parted/partimage: alternative partition editing utilities
- cdrtools: create custom CD formats for recording purposes
- dvd-record: create custom DVD formats for recording purposes
When repairing a Windows-based system, there are software tools for changing NT passwords (chntpw), manipulating NTFS volumes (mkntfs, ntfsclone, nftsmount, ntfsresize), and for working with FAT partitions. In fact, Linux offers a wealth of software options, from platform-specific file system tools (RAID, LVM, JFS, XFS, and ReiserFS tools), grub and lilo boot managers, CD and DVD burning applications, and a number of Internet-related utilities (includig Firefox, e-mail agents, news readers, and IRC clients).
Ultimately, the USB key-drive recovery solution saves both time and effort when creating recovery tools, updating them for use with new software, and testing the final product. Unlike a CD image, salvageable data can be copied directly to the USB drive without the need to load an OS or call applications required to store the data. Flexibility is essential to any working recovery solution, since features may need to be added, removed, or changed as necessary; the USB handles all well. Similarly, CD or DVD disc creation requires at least two additional elements: a CD or DVD burner and the accompanying software to create a burnable disc. USB is more efficient, since it is usable as soon as it's plugged into a computer.
JUSTIN KORELC is a freelance writer based in Austin, Texas, who specializes in Linux security, networking, and implementation subjects and occasional Windows topics.