Restore GRUB after Windows 8 install

After upgrading to Windows 8 Pro 64-bit recently I had to restore GRUB to my MBR so I could boot back into Ubuntu. First off I used the Ubuntu 12.04 LTS install CD to boot into a live session, then from a Terminal session I tried to run:

sudo grub-install /dev/sda

However it failed with the following message:

/usr/sbin/grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?)

Thanks to this post I was able to resolve the problem by first mounting my root partition:

sudo mount /dev/sda5 /mnt

Then trying the grub install with an extra parameter:

sudo grub-install /dev/sda --boot-directory=/mnt/boot/