L'ardoise eduvax

Blog, free software projects, computer tips and more

Install grub manually to make disk bootable

Written by Sebastien Devaux - - no comments

Use this procedure to repair a broken boot of a system disk boot or to make a new restored system disk bootable. To run the procedure you need an already running linux. If not available, use a live CD or USB key. The disk to make bootable must already contain a partition with almost complete linux system: in particular drub binaries and /boot directory with kernel and grub configuration.

  • first ensure what is the partition containing the /boot directory. In the following it's considered to be /dev/sdb1. Check this partition has the bootable flag and add it if not (defaulty use fdisk to proceed).
  • mount the root partition, and special file system at the right place relatively to the future root partition mount point.
# mount /dev/sdb1 /mnt/
# mount -t proc none /mnt/proc
# mount -o bind /dev /mnt/dev
# mount -t sysfs sys /mnt/sys
  • start a chrooted shell into the future root file system and install grub from it.
# chroot /mnt/ /bin/bash
# update-grub
# /usr/sbin/grub-install --recheck --no-floppy /dev/sdb
  • terminate chroot shell and unmount partitions properly and the disk is ready to boot.

Write a comment