Help! I deleted a Linux boot partition

I deleted a partition on my Linux system, but I still see a boot menu. How do I re-install GRUB2 and not lose data?

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:

Popular rescue distributions

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.

Join the conversation

1 comment

Register

I agree to TechTarget’s Terms of Use, Privacy Policy, and the transfer of my information to the United States for processing to provide me with relevant information as described in our Privacy Policy.

Please check the box if you want to proceed.

I agree to my information being processed by TechTarget and its Partners to contact me via phone, email, or other means regarding information relevant to my professional interests. I may unsubscribe at any time.