know your partitioning scheme and the location of your Ubuntu installation—
the partition will probably be on a drive called sda on the first partition,
which you can mount now by using this:
Click here to view code image
matthew@seymour:~$ sudo mount /dev/sda1 /mnt
This mounts the drive in the current file system (running from the live DVD)
at /mnt, where it will be accessible to you for reading and modifying as
needed. Next, you reinstall GRUB2 on this device:
Click here to view code image
matthew@seymour:~$ sudo grub-install -–boot-directory=/mnt/boot
/dev/sda
At this point, reboot (using your hard drive and not the live DVD), and all
should be well. After the reboot is complete, enter the following:
Click here to view code image
matthew@seymour:~$ sudo update-grub
This refreshes the GRUB2 menu and completes the restoration. You can find
a lot of great information about GRUB2 at
https://help.ubuntu.com/community/Grub2.
Saving Files from a Nonbooting Hard Drive
If restoring the GRUB2 boot loader fails and you still cannot boot from the
hard drive, try to use the live DVD to recover your data. Boot and mount the
hard drive as shown previously and then attach an external storage device
such as a USB thumb drive or an external hard drive. Then copy the files you
want to save from the mounted drive to the external drive.
If you cannot mount the drive at all, your options become more limited and
possibly more expensive. In this case, it is likely that either the hardware has
failed or the file system has become badly corrupted. Either way, recovery is
either impossible or more difficult and best left to experts if the data is
important to you. But, the good news is that you have been making regular
backups, right? So, you probably lost only a day or maybe a week of work
and can buy a new drive, install it, and start from scratch, putting the data
from your backup on your new Ubuntu installation on the new hardware.
Every experienced system administrator has had a drive fail; no hardware is
infallible. We expect occasional hardware failures, and that’s why we have
good backup and recovery schemes in place for data. There are two types of