Taken from here.
http://newbiedoc.berlios.de/wiki/How_to_create_a_Grub_disc_to_boot_a_Debian_GNU/Linux_system
1 The advantage of having a Grub boot disc
If you have more than one operating system on a dual- or multi-boot Debian system, you run a small risk of damaging the Grub bootloader. This might happen if another operating system overwrites the boot sector. It might also happen if you have several versions of Debian on different partitions and you remove one of them. The answer is to create a Grub boot disc (floppy or CD) that will boot into Debian on a partition that you know will never be moved or removed.
2 Create a boot floppy
The way to create a Grub boot floppy for Debian, based on the article at http://www.linuxjournal.com/comment/reply/4622, is as follows.
Boot into your Debian system. If you have more than one, boot into the system that you know will remain permanently on your hard drive. Insert a floppy disc in your floppy drive and format it. Add a file system. This could be anything that Debian will recognise (eg ext2), but these commands will add an MSDOS filesystem.
fdformat /dev/fd0
mkfs -t msdos /dev/fd0
Mount the floppy and copy the /boot/grub directory and its contents from the running system to the floppy. Unmount the floppy.
$ mount -t msdos /dev/fd0 /media/floppy
$ mkdir -p /media/floppy/boot/grub
$ cp /boot/grub/* /media/floppy/boot/grub
$ umount /media/floppy
Install the GRUB boot loader in the MBR of the floppy itself. Run grub and enter these commands at the grub prompt.
$ grub
grub> root (fd0)
grub> setup (fd0)
grub> quit
That's it! To test the floppy, restart the system with the floppy in the drive. You can select which operating system to boot from the usual blue menu.
3 Create a boot CD
You can find basic instructions for creating a bootable Grub disc in the manual at http://www.gnu.org/software/grub/manual/html_node/Making-a-GRUB-bootable-CD_002dROM.html#Making-a-GRUB-bootable-CD_002dROM. By adding a slightly modified menu.lst you can create a CD which will boot your system from the usual blue menu.
In your "home" directory create a directory (eg "iso") in which to place the files for the CD.
$ cd ~
$ mkdir iso
Make a directory for Grub and copy the file "stage2_eltorito" to it from /usr/lib/grub/i386-pc/.
$ mkdir -p iso/boot/grub
$ cp /usr/lib/grub/i386-pc/stage2_eltorito iso /boot/grub
Also copy the menu.lst file to it from /boot/grub.
cp /boot/grub/menu.lst iso/boot/grub
Now edit iso/boot/grub/menu.lst and remove any lines identical to "savedefault". Leaving these commands will cause an error because the CD is a read-only disc. A typical menu entry will look like this once "savedefault" has been removed:
title Debian GNU/Linux, kernel 2.6.18-3-686
root (hd0,5)
kernel /boot/vmlinuz-2.6.18-3-686 root=/dev/hda6 ro
initrd /boot/initrd.img-2.6.18-3-686
Finally, make a ISO9660 image file called "grub.iso".
$ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot
-boot-load-size 4 -boot-info-table -o grub.iso iso
Burn the image file onto CD or a DVD. If you are using K3B or GnomeBaker, choose "Burn CDROM Image" from the "Tools" menu. If you are using the command line, you can use cdrecord. There is an explanation of how to do this at http://www.debian-administration.org/articles/273.
That's it! To test the CD, restart the system with the CD in the drive. You can select which operating system to boot from the usual blue menu.
4 How to use the Grub boot disc to repair the MBR
--Chris Lale 15:32, 2 March 2007 (CET)
Your system may stop booting from the hard drive if you install Windows or install another instance of Debian and then remove it.
Just boot from your Grub floppy or CD, login, switch user to user root and re-install the Grub bootloader. If your first master hard disc is IDE, enter
# grub-install /dev/hda
If your first master hard disc is SCSI or SATA, use
# grub-install /dev/sda
Data from my Linspire partition on hda6.
user@user:/mnt$ cd /mnt/hda6user@user:/mnt/hda6$ ls -l
total 69
-rw-r--r-- 1 root root 938 2007-08-11 15:12 %1
-rw-r--r-- 1 root root 17 2005-03-16 13:28 base.tgz.size
drwxr-xr-x 2 root root 2168 2005-06-06 21:17 bin
drwxr-xr-x 3 root root 576 2007-03-26 12:39 boot
drwxr-xr-x 2 root root 48 2006-04-13 10:06 cdrom0
drwxr-xr-x 2 root root 48 2006-04-13 10:06 cdrom1
-rw------- 1 root root 1348 2004-06-25 09:11 config.dat-old
drwxr-xr-x 3 root root 144 2005-03-16 13:28 dev
drwxr-xr-x 5 root root 120 2006-12-04 13:38 disks
drwxr-xr-x 156 root root 8424 2007-09-02 15:22 etc
drwxr-xr-x 2 root root 48 2006-04-13 10:06 floppy1
drwxr-xr-x 2 root root 48 2006-04-13 10:06 floppy2
drwxr-xr-x 2 root root 48 2006-04-13 10:06 hda6
drwxrwsr-x 3 1000 1000 72 2005-10-12 00:11 home
drwxr-xr-x 2 root root 48 2005-03-16 13:14 initrd
drwxr-xr-x 13 root root 4504 2007-04-27 11:29 lib
-rwxr-xr-x 1 root root 1390 2004-04-01 05:21 makedeb
drwxr-xr-x 2 root root 48 2005-03-16 13:14 media
drwxr-xr-x 50 root root 1328 2007-09-01 18:11 mnt
lrwxrwxrwx 1 root 1000 22 2007-08-12 16:54 My Computer -> /home/paul/My Computer
drwxr-xr-x 9 root root 224 2007-08-05 18:00 opt
drwxr-xr-x 2 root root 48 2004-11-12 15:04 proc
-rw-r--r-- 1 root root 328 2003-09-05 11:29 README.txt
drwxr-xr-x 58 root root 3536 2007-09-02 15:22 root
dr-xr-xr-x 2 root root 48 2005-03-16 13:33 rr_moved
drwxr-xr-x 2 root root 8688 2007-04-05 20:11 sbin
drwxr-xr-x 2 root root 48 2005-03-16 13:14 srv
drwxr-xr-x 7 root root 168 2005-06-09 10:17 storix
-rw-r--r-- 1 root root 9290 2004-04-15 07:38 storix.admin.list
-rw-r--r-- 1 root root 4262 2004-04-15 07:38 storix.client.list
-rw-r--r-- 1 root root 0 2004-03-31 13:15 storix.cl.list
-rw-r--r-- 1 root root 0 2004-03-31 13:15 storix.na.list
drwxr-xr-x 2 root root 48 2004-12-05 08:13 sys
drwxrwxrwt 13 root root 568 2007-09-02 15:22 tmp
drwxr-xr-x 20 root root 552 2006-10-01 23:49 usr
drwxr-xr-x 22 root root 528 2006-07-28 11:16 var
lrwxrwxrwx 1 root root 19 2005-05-06 13:43 vmlinuz -> boot/vmlinuz-2.6.10
user@user:/mnt/hda6$ cd /mnt/hda6/boot/grub/
user@user:/mnt/hda6/boot/grub$ ls -l
total 420
-rw-r--r-- 1 root root 4008 2005-01-31 10:47 bootsplash.xpm.gz
-rw-r--r-- 1 root root 7776 2005-02-19 11:35 e2fs_stage1_5
-rw-r--r-- 1 root root 7504 2005-02-19 11:35 fat_stage1_5
-rw-r--r-- 1 root root 8320 2005-02-19 11:35 jfs_stage1_5
-rw-r--r-- 1 root root 1342 2006-04-14 04:59 menu.lst~
-rw-r--r-- 1 root root 221 2006-04-14 10:56 menu.lst.bak
-rw-r--r-- 1 root root 1601 2006-04-14 16:31 menu.lst.bak~
-rw-r--r-- 1 root root 221 2006-04-14 10:48 menu.lst.bak~~
-rw-r--r-- 1 root root 1601 2007-06-25 21:15 menu.lst.bak2
-rw-r--r-- 1 root root 221 2007-06-25 21:10 menu.lst.bak3
-rw-r--r-- 1 root root 1142 2006-04-28 12:48 menu.lst.good
-rw-r--r-- 1 root root 1429 2006-12-10 15:01 menu.lst.saved
-rw-r--r-- 1 root root 7008 2005-02-19 11:35 minix_stage1_5
-rw-r--r-- 1 root root 39428 2005-02-19 11:35 reiser4_stage1_5
-rw-r--r-- 1 root root 9216 2005-02-19 11:35 reiserfs_stage1_5
-rw-r--r-- 1 root root 512 2005-02-19 11:35 stage1
-rw-r--r-- 1 root root 141412 2005-02-19 11:35 stage2
-rw-r--r-- 1 root root 141412 2005-02-19 11:35 stage2_eltorito
-rw-r--r-- 1 root root 9256 2005-02-19 11:35 xfs_stage1_5
user@user:/mnt/hda6/boot/grub$ cat menu.lst.good
# Generated by jiffyboot version 7.0.53. If this file is edited, the
# system will stop modifying it. To allow the system to resume
# management of this file, remove it and run /sbin/jiffyboot
default=0
timeout=10
color cyan/green magenta/green
splashimage=/boot/grub/bootsplash.xpm.gz
title Linspire 5.0.59 on /dev/hda6
root (hd0,5)
kernel /boot/vmlinuz-2.6.10 root=/dev/hda6 rootdev=0x0306 ramdisk=32000 vga=0x311 splash=silent video=vesafb:nomtrr video=vesafb:nomtrr jiffymount=noatime
initrd /boot/initrd-2.6.10.gz
# (Boot priority: 102, mounted at /)
title Redetect
root (hd0,5)
kernel /boot/vmlinuz-2.6.10 root=/dev/hda6 rootdev=0x0306 ramdisk=32000 noresume2 redetect video=vesafb:nomtrr video=vesafb:nomtrr jiffymount=noatime
initrd /boot/initrd-2.6.10.gz
# (Boot priority: 102, mounted at /)
title Diagnostics
root (hd0,5)
kernel /boot/vmlinuz-2.6.10 root=/dev/hda6 rootdev=0x0306 ramdisk=32000 noresume2 single splash=0 Diagnostics video=vesafb:nomtrr video=vesafb:nomtrr jiffymount=noatime
initrd /boot/initrd-2.6.10.gz
# (Boot priority: 102, mounted at /)
title MS Windows 98 on /dev/hda1
root (hd0,0)
chainloader +1
user@user:/mnt/hda6/boot/grub$
Menu.lst from Ubuntu 7.04 on hdb
# Taken from Ubuntu 7.04 installation, on hdb? therefore 'root (hd0,0)' has to be wrong.# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 20
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu
# Pretty colours
#color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the Debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=9cca91b7-96a4-4cf9-b8cb-3dd1ab1c6730 ro
## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0
## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurrence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## ## End Default Options ##
title Ubuntu, kernel 2.6.20-16-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=9cca91b7-96a4-4cf9-b8cb-3dd1ab1c6730 ro quiet splash
initrd /boot/initrd.img-2.6.20-16-generic
quiet
savedefault
title Ubuntu, kernel 2.6.20-16-generic (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=9cca91b7-96a4-4cf9-b8cb-3dd1ab1c6730 ro single
initrd /boot/initrd.img-2.6.20-16-generic
title Ubuntu, memtest86+
root (hd0,0)
kernel /boot/memtest86+.bin
quiet
### END DEBIAN AUTOMAGIC KERNELS LIST
Note: I think that the value '(hd0,0)' here is in error!
Note : I think that the last installation, Debian Netinstall, used what was hdb1 but has now been reallocated to hdb12 as root, hdb13 as /home and hdb14 as /user. The latter is a trial of having a common data file between installed versions of Linux.
I am now going to build a boot floppy