During install fests we sometimes need to install grub on a disk that is currently not mounted on root. For example, if a system can’t be booted from its hard drive, but can be booted from a live usb, we want to boot from the live usb and “repair” the hard drive by installing grub on the hard drive. Once the hard drive is “repaired,” the system can be booted again from the hard drive.
- boot the system with a live usb
- make sure that the system hard drive is mounted. Find out what its block device name is and on what folder it is mounted. For this you might want to use the “df” command.
- make yourself the super user by issuing the command “sudo su -”
- use the mount command to mount the /dev and /proc mounts to “mountpoint”/dev and “mountpoint”/proc
- chroot into “mountpoint”
- run the following command “grub-install “blockdevname”
Let’s assume that your system is booted via live usb, and the partition on which you have your operating system is /dev/sda3, and that partition is mounted as /mnt/hdsystem, “blockdevname” is /dev/sda (note that it is /dev/sda, it is NOT!!! /dev/sda3!!!), and “mountpoint” is /mnt/hdsystem.