Three Approaches to Making Linux Rescue Diskettes or CD-ROM
This is an outline for a talk given on December 9, 1999, at the San Gabriel Valley Linux Users' Group Meeting. Additional notes have been added since then regarding writing bootable CD's and using initial ramdisks.
The normal way to make a boot diskette set is to use the facilities supplied with the RedHat, SuSE, etc. distribution you have installed. Read the manual, insert the diskette(s) and follow directions. For many people, this is adequate.
For the inquiring mind or power user, that procedure is inadequate. It shields the user from really understanding what is on the diskettes and how they work. The aim here is to explain the boot process and to walk you through rolling your own boot diskettes. In the long run, understanding how something works often takes less time and is less error-prone than blindly following a procedure. This description, however, is no substitute for reading and understanding the relevant ample documentation, but should make that task easier.
Craig Van Degrift / KanjiFlash@CompuServe.com / revised February 27, 2000
- Kernel image placed on a diskette without any filesystem
How it works
This works because the kernel image is produced with a boot loader as its first 512 bytes followed by 4 kB of setup code.
Use
- If you lose your master boot record or the kernel image on your hard disk, you can still boot.
Weaknesses
- If your root device is screwed up, you're still stuck.
- You must remember to update your boot diskette whenever you change your kernel, System.map, or partitions.
This example illustrates the simplest Linux boot process.
- Lilo and kernel on boot diskette with a minimal root filesystem on a second diskette
How it works
The "boot" diskette loads the kernel with load_ramdisk=1, prompt_ramdisk=1 and root=/dev/fd0 parameters. The kernel initializes itself and then mounts a ramdisk root filesystem in /dev/ram0 that has been filled with the decompressed contents of the "root" diskette.
Uses
- You can have a useful command-line Linux system running in memory without touching your hard disk.
- You can examine and work with any of your hard disk partitions.
- You can do backup and recovery operations between hard disk partitions and CD-R, CD-ROM, or tape devices.
- You can fix problems with your library and init setup on your root filesystem.
- You can boot another operating system.
- If you don't include the devices that access your fixed disk filesystems in /dev, you can confidently play with this RAM-based Linux system without endangering any of your permanent files.
Weaknesses
- You must remember to update your boot diskette data when you change your hardware or partitions.
- X-Windows is too big for this approach. You are restricted to command line work.
This example illustrates the use of Lilo, the essential items needed in a root filesystem, and how /bin/init works.
- Lilo, kernel, and root filesystem on CD-ROM
How it works
Two tricks needed for this are:
- The El Torito bootable CD format is used in which an image of a 1440 kB boot diskette is placed within the filesystem on the CD (e.g. in its /boot directory). It is identified as the boot image by the software (mkisofs -b option) that packages the filesystem into an ISO-9660 CD format.
- A compressed initial ramdisk image is included in the boot diskette image and loaded by the Lilo loader into a special temporary ramdisk /dev/initrd which the kernel then copies to /dev/ram0. This root filesystem is used in either of two distinct ways:
- lilo.conf specifies root=/dev/ram0
In this case, the initial ramdisk fills itself out by copying additional files from the CD-ROM and becomes the final root filesystem.
- lilo.conf specifies root=some fixed disk partition>
Here, the initial ramdisk is only temporarily mounted as root. It examines the system and synthesizes the final fixed disk filesystem which ultimately becomes the root filesystem.
Uses
- Anything you use Linux for, including X-Windows applications
- Creating installation CD's using a collection of candidate driver modules in an "initial ramdisk"
- Making backup Cd-ROMs that boot into RAM without touching fixed disks.
Weakness
- Be sure to have abundant RAM.
- Difficult to configure and update.
This example illustrates some aspects of how distribution install CDs are produced.