learn by doing

How to restore grub using chroot

Below is a small tutorial of how you can install grub by chrooting into the the partition you would like to install the bootloader.

I found it useful for XEN to KVM virtual machine migration:

mount /dev/sda /mnt/
mount -o bind /dev /mnt/dev
chroot /mnt/
mount -t proc none proc
mount sysfs /sys -t sysfs
grub-install -f /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg