Linux Step By Steps

Making a GRUB Boot Floppy Disk


From Bruce Marshall

This writeup describes how to make bootable floppy disk with a self-contained copy of GRUB on it. Such a boot floppy is very handy for:

  1. Testing various configurations of GRUB and the booting of multiple Operating Systems.
  2. As a recovery diskette when GRUB has been destroyed by that 'other' Operating System.

The following assumes that you are using Caldera eD2.4 and that all GRUB components are kept in the /boot/grub directory.

Note: The /etc/grub.conf file is used only to install grub and is not used by grub directly. We will create a new version of this file.

  1. Format a floppy disk in FAT format:

    mkfs -V -t msdos /dev/fd0 <== use fd0 or fd1 as appropriate

  2. Mount the floppy:

    mount /dev/fd0 /mnt

  3. Create a boot directory and a grub directory on the floppy:

    mkdir /mnt/boot
    mkdir /mnt/boot/grub

  4. Copy all files from /boot/grub to the floppy:

    cp -pa /boot/grub/* /mnt/boot/grub


  5. Unmount the floppy disk:

    umount /mnt
    <now we modify the /etc/grub.conf file to install grub on the floppy>
  6. Make a copy of /etc/grub.conf and call it: /etc/grubfd.conf:

    cp /etc/grub.conf /etc/grubfd.conf

  7. Edit the new /etc/grubfd.conf file to look as follows:
    #                                                                                          
    # /etc/grubfd.conf - make a floppy boot disk                                               
    #                                                                                          
    # To install grub on the floppy, issue the following command:                              
    #  grep -v ^# /etc/grubfd.conf | grub --batch                                              
    #                                                                                          
    root (fd0)                                                                                 
    install /boot/grub/stage1 d (fd0) (fd0)/boot/grub/stage2 0x8000 p (fd0)/boot/grub/menu.lst 
    quit  
    
  8. Install GRUB on the floppy disk:
    grep -v ^# /etc/grubfd.conf | grub --batch
    
    
        GRUB  version 0.5.94  (640K lower / 3072K upper memory)                                        
                                                                                                       
     [ Minimal BASH-like line editing is supported.  For the first word, TAB                           
       lists possible command completions.  Anywhere else TAB lists the possible                       
       completions of a device/filename. ]                                                             
                                                                                                       
    grub> root (fd0)                                                                                   
     Filesystem type is fat, using whole disk                                                          
                                                                                                       
    grub> install /boot/grub/stage1 d (fd0) (fd0)/boot/grub/stage2 0x8000 p (fd0)/boot/grub/menu.lst  
                                                                                                       
    grub> quit
    

And you are Done!!

Note: The above will make a boot floppy with the same GRUB menu.lst as that which exists on your Hard Drive. Modify the menu.lst on the floppy as suits your needs. Information on the menu.lst file can be found in other GRUB files on the Step-by-step site.