Recover Grub

I installed Windows 7 on my old laptop, which already had Ubuntu installed. As expected, I lost the boot manager (Grub2).

  1. Boot from an Ubuntu live CD. In a previous post I explained how to create a live USB.

  2. Find out the /boot partition (here it is /dev/sda6):

    ubuntu@ubuntu:~$ sudo fdisk -l
    /dev/sda6            3984        3996       96256   83  Linux
    
  3. Mount this partition

    ubuntu@ubuntu:~$ sudo mkdir /media/boot
    ubuntu@ubuntu:~$ sudo mount /dev/sda6 /media/boot
    
  4. Reinstall Grub

    ubuntu@ubuntu:~$ sudo grub-install --boot-directory=/media/boot /dev/sda
    
  5. Restart the computer and log in to Ubuntu.

  6. Add Windows and all other operating systems to the grub menu

    julio@julio-acer ~> sudo update-grub2
    [sudo] password for julio:
    Generating grub.cfg …
    Found linux image: /boot/vmlinuz-2.6.38-8-generic-pae
    Found initrd image: /boot/initrd.img-2.6.38-8-generic-pae
    Found memtest86+ image: /memtest86+.bin
    Found Windows 7 (loader) on /dev/sda1
    done
    

Julio Batista Silva
Julio Batista Silva
Data Engineer

I’m a computer engineer passionate about science, technology, photography, and languages. Currently working as a Data Engineer in Germany.

comments powered by Disqus