Sunday, 25 May 2008

Where is my GRUB?

On the Gentoo mailing list, a nice thread evolved a way to find where did you install your bootloader last time. The question is less trivial than it seems - is it on your disk MBR or on your partition? If you have a non-obvious setup, you may forget... and if you try to upgrade/reinstall GRUB without remembering where it is, bad things can happen.

The solution is:
for i in /dev/[hs]d*
dd if=$i bs=446 count=1 2>/dev/null | strings | grep -q GRUB \
&& echo "GRUB found in $i"