If you've got a cheap USB key lying around which is too small to be useful, follow these instructions to create a rescue "stick" in case your boot loader stops working.
(This is based on these instructions but simplified and updated for grub 2.)
Before you start, make sure you've got both the
parted and the
grub-pc packages installed.
Make the USB stick bootable
Plug in your USB stick and replace the device name and capacity with the appropriate values. (You can find the total capacity of the stick by typing
$ sudo parted /dev/sda (parted) rm 1 (parted) mkpart primary 1MB 4009MB (parted) mkfs 1 fat32 (parted) toggle 1 boot (parted) quit
sda with the correct device name.
mount /dev/sda /mnt mkdir -p /mnt/boot/grub cp /usr/lib/grub/i386-pc/* /mnt/boot/grub/ echo '(hd0) /dev/sda' > /mnt/boot/grub/device.map sudo grub-install --root-directory=/mnt /dev/sda umount /mnt
That's it, now all you have to do is reboot with the stick plugged in and test booting your box manually with it.