Linux Emergency Filesystems and Procedures

Posted: September 24, 2010 in Uncategorized

There are several ways to make a boot floppy, but basically there would be two types of boot floppys that make sense. The first is a simple boot floppy with a copy of your kernel that will mount your root device which is usually on your hard drive. This will give you another way to boot to your system and allow you to repair some problems such as a bad re-compile of a kernel or a lilo failure, but will not do much good if you develop a serious problem with your root filesystem. The second is a more elaborate boot floppy including a boot and root floppy and will independently support some tools that will allow repair of a root filesystem, or at least help you rescue files.
Making a simple Emergency boot floppy

How to make a single boot floppy:

1. Find the kernel. It is usually /vmlinuz or /boot/vmlinuz. The file vmlinuz may be a softlink to the actual kernel executable. Find the executable kernel.
2. Copy the kernel image to the floppy.

dd if=/vmlinuz of=/dev/fd0
3. Type the command “df” and examine it’s output to determine where your root filesystem is. Your root is “/” and is mounted on something like “/dev/hda2”.
4. Set the kernel image on the floppy to the location of your root system.

rdev /dev/fd0 /dev/hda2

Your root filesystem may be somewhere other than “/dev/hda2”.
5. Test the floppy by rebooting your system and attempting to boot from it.

You can use the command “badblocks /dev/fd01440 1440” to check the floppy for badblocks.

Making a Boot Floppy with a Root Filesystem (not yet complete or accurate)

To make a Linux boot floppy with a root floppy will require two floppy disks. One will be used for the kernel, and the other will hold the root filesystem.

Important functions needed by an emergency boot filesystem:
e2fsck, mount, tar, gzip, insmod, ftape module for kernel if using tape backups

Please note, that it is best to recompile your kernel to do this. This is because most kernel images use modules for support that are stored on your root filesystem and if your root filesystem is corrupt, it may not work properly. The good news is, however, that you will only need a kernel with minimal support, since this is for emergency use only, and you won’t need networking support and some other features. The other option is to use a kernel image already compiled that does not depend on modular support if you can find one.

1. Compile the kernel:
Most options, you may answer no to with the following exceptions.
* Make processor type 386 to support all machines with 1Gb of memory.
* Enable PCI support with access mode=any and quirks=y.

To compile the kernel make sure you provide floppy, CD-ROM and hard disk support for your types of devices such as IDE or SCSI. In my compile, I support IDE only. Set CONFIG_BLK_DEV_IDE=Y and all in the IDE category may be set to Y except for “other IDE chipset support”, CONFIG_IDE_CHIPSETS=N. Ramdisk support (CONFIG_BLK_DEV_RAM=Y) with initial support. Virtual terminals (CONFIG_VT=Y). CONFIG_VT_CONSOLE=Y, CONFIG_SERIAL=Y, CONFIG_MOUSE=Y, CONFIG_PS2MOUSE=Y. Under filesystems I supported all but quota, kernel automounter support, and UMSDOS. Include all under partition table support. Include VGA text console and Magic SysRq key.
2. Copy the kernel image to the first floppy.

dd if=/vmlinuz of=/dev/fd0
3. Set the image on the floppy to boot to a root filesystem on your floppy device.

rdev /dev/fd0 /dev/fd0
4. Prepare the root floppy (the second floppy disk)
1. type “fdformat /dev/fd0H1440” to format the floppy
2. type “mkfs -t ext2 -c /dev/fd0H1440” to create a filesystem on the floppy


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s