Skip to content

Instantly share code, notes, and snippets.

@h3xxx
Created June 27, 2014 06:21
Show Gist options
  • Save h3xxx/6bfcca683027cc30ce71 to your computer and use it in GitHub Desktop.
Save h3xxx/6bfcca683027cc30ce71 to your computer and use it in GitHub Desktop.
reinstall Grub on harddisk using USB Linux
# let's assume you want to reinstall Grub on /dev/sda where Linux is on /dev/sda2
sudo mkdir /mnt/temp
sudo mount /dev/sda2 /mnt/temp
sudo mount --bind /dev /mnt/temp/dev &&
sudo mount --bind /dev/pts /mnt/temp/dev/pts &&
sudo mount --bind /proc /mnt/temp/proc &&
sudo mount --bind /sys /mnt/temp/sys
sudo chroot /mnt/temp
grub-install /dev/sda
grub-install --recheck /dev/sda
update-grub
exit &&
sudo umount /mnt/temp/sys &&
sudo umount /mnt/temp/proc &&
sudo umount /mnt/temp/dev/pts &&
sudo umount /mnt/temp/dev &&
sudo umount /mnt/temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment