How To Recover GRUB & GRUB2 in Linux Systems
This comprehensive tutorial is designed to guide users through the process of recovering GRUB and GRUB2, which are essential components for booting Linux systems. In situations where both Linux and Windows are installed on the same hard drive and Windows is reinstalled or installed alongside Linux, the Windows Master Boot Record (MBR) may delete GRUB, rendering the Linux system unable to boot.
What is GRUB?
Fortunately, this tutorial provides a step-by-step solution for recovering GRUB and GRUB2. Before getting started, it is important to understand that GRUB is a boot manager developed by the GNU project that allows users to have multiple operating systems on their PC and boot from each of them.
To begin the recovery process, users will need to have a Linux Live CD on hand. With the help of this tutorial, users can rest assured that they will be able to successfully recover GRUB and GRUB2, ensuring that their Linux system is up and running smoothly once again.
How to recover GRUB
We will start by recovering the GRUB.
Insert the CD or USB with Linux and restart the PC, start in BIOS mode and configure the boot so that your external device is first. When you finished, save and reboot.
When you start again, you will do it through our Live CD.
Now, we execute the following commands, first:
sudo fdisk -l
Write down the device that has Linux type. In my case sda1. Now it’s time to execute:
And in this case, we have to take into account what was seen in the fdisk command. If Linux is in sda the X will be 0, if it is sdb, it will be 1…, and the Y will be the number that appears next to sda, but subtracting 1.
When we finish we close the terminal and restart (do not forget to change the boot order or remove the external device) and we can access our Linux.
How to recover GRUB 2
Now let’s see how to recover the GRUB 2 from Ubuntu.
Follow the first to steps in the previous section.
sudo fdisk -l
We will get information, look where it says in Type Linux and write down the Device column, in this case, /dev/sda1.
Now we have to mount the partition, for this we execute:
sudo mount /dev/sda5/mnt
The GRUB bootloader files are installed, execute the following, keep in mind that sda is the boot disk, put yours, mine, in this case, is sda:
sudo grub-install --root-directory=/mnt/ /dev/sda
Restart the PC, without forgetting to change the boot order or remove the external device. This will make us start the Ubuntu that we had installed.
Now we have to execute a few more commands, so reopen the terminal and execute:
sudo grub -mkconfig
It helps us to avoid errors in partitions and that we can start Windows from the GRUB. You’ll see many letters come out on screen, quiet is usual, wait until it’s over.
Now we execute a command to update the GRUB:
sudo update -grub2
You’re done, you should be able to start your PC on both Windows and Linux.
It might be interesting
How To Edit & Modify HOSTS File in Linux
How to edit and modify the IP address hosts file on Linux systems.
Updates on Sports and Technology
The Sports and Technology survey conducted by the Consumers Electronics Association has revealed that sports and technology have outpaced all forms of traditional media like the radio or any print media like the magazines or any newspapers.
Some Pet-owners-handy iPhone apps
Every now and then there are some new sources that come up with handful of magical tech-things for your pets, as they can realize well the importance of your pets in your lives.
Apple issues its own list of top 20 paid -for and free iPhone apps
It was in July last year when the iPhone 3G emerged, as a groundbreaking handset with loads of chanting features and Apple’s cash cow (App Store) support.