.shock - Fotolia
Let's set the scenario: You've either accidentally deleted your Linux boot partition or an update went wrong and deleted it. Now you're unable to access your data.
Your best bet is to rescue the data -- using a Linux-based rescue disk -- and re-install or go into rescue mode, if the distribution allows, and repair.
There are plenty of methods to either repair GRUB2 or another Linux boot loader or recover data from a non-booting machine.
Let's examine how to repair the Linux boot loader by repairing GRUB2 on an Ubuntu desktop machine. You can do the repair through the graphical user interface or use the command line -- the graphical route is simple.
You must have the distribution's installation media on CD or USB flash drive. Boot the machine where GRUB2 is not functioning with this media. When prompted, click the button to try Ubuntu, not to install it. Once the live desktop is running, open up a terminal window by pressing [Ctrl][Alt][t] on the keyboard. When the terminal window is open, enter the following commands:
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
When prompted, enter your sudo password to continue. Once the installation is complete, run the Boot Repair tool with the command:
When the app runs, click Recommended Repair
Once the boot repair is complete, reboot and you should be able to run the Linux machine with your data.
If repairing the boot partition doesn't work and you still don't have access to the data on the machine, there's more to try. There are Linux distributions geared specifically for such a task. Burn one of the ISO images -- an exact copy of a file system -- to a disk, boot the broken system with the newly created disk, locate the data with the distribution's file manager, and copy the data to an attached external drive.
Even if your Linux box is unable to boot, the data isn't lost. Either repairing your boot loader or using one of the data recovery distributions will save your information.
Fix Linux boot problems with GRUB
Linux boot options in RHEL, SLES with GRUB2
Guide to Linux troubleshooting
Dig Deeper on Linux servers
Related Q&A from Jack Wallen
It's important to prevent data loss during a Linux OS upgrade. How can partitions or disk drives help IT teams meet that goal? Continue Reading
As Android Nougat starts hitting devices, some IT admins may be dreading the rollout. But new and improved security features make the new OS much ... Continue Reading
Android users can sideload apps outside of the Google Play Store, but these apps aren't screened for malware like commercial apps are. IT must urge ... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.