1

I am running Ubuntu 15.04, installed on a 256GB SSD. There is no other operating system there - just a small boot partition, an ext4 partition with my data, and a swap partition.

A few minutes ago, I wanted to format a USB key with several partitions. Needless to say, I got confused and formatted the boot partition in my SSD drive as NTFS instead. (I chose the quick option, without data erasure.) Noticing what I had done, I formatted it as FAT (which I think it was before the accident). I then tried to reboot the computer, but it failed to reboot; it gave me a "No bootable devices found. Press F1 key to retry boot, Press F2 key, etc." message.

What can be done?

  • You will have to re-install Ubuntu. – Pilot6 Jul 14 '15 at 18:31
  • But will I be able to keep the data in the untouched partition? – H A Helfgott Jul 14 '15 at 18:32
  • Yes, you can re-install and keep your /home partition with your files. You will probably need to re-install programs too. – Pilot6 Jul 14 '15 at 18:33
  • You need to chose manual partitioning and do not format /home partition. Maybe someone will give a link to a good manual. – Pilot6 Jul 14 '15 at 18:34
  • Just restore your system back-up or if you don't have one, start making them... :-( The manual to re-install is here – Fabby Jul 14 '15 at 18:47
2

You wrote:

Noticing what I had done, I formatted it as FAT (which I think it was before the accident).

If the partition was indeed FAT before the accident, then that suggests it was an EFI System Partition (ESP), which in turn implies you were booting in EFI mode. If this is correct, then recovery is relatively simple, and can be done in several ways, the easiest two of which are:

  • Boot to an Ubuntu live CD in EFI mode, install the Boot Repair tool, and run it. This should install a fresh copy of GRUB on your ESP and everything should start working again.
  • If Secure Boot is enabled in your firmware, disable it; then download the USB flash drive or CD-R version of my rEFInd boot manager, prepare a boot medium from it, and boot using it. rEFInd should give you options to boot your Linux kernel. Boot it. Once Linux is running, you can open a Terminal and either:
    • Install the rEFInd PPA or Debian package, as described on the rEFInd downloads page.
    • Mount your ESP at /boot/efi, then type sudo grub-install followed by sudo update-grub to re-install and configure GRUB.

Before you attempt either of these procedures, though, I recommend you check for existing kernels by mounting your Ubuntu root (/) partition and checking the contents of its /boot directory. If that directory is empty, then you have no kernels, which means the partition you overwrote was probably a Linux /boot partition and not an ESP. In this case, you must re-install your kernels. If you see a number of files, including ones with names that begin vmlinuz, then you did not overwrite a /boot directory and chances are you can recover your system with the either of the procedures I've just outlined.

If you need to recover your kernels, then the procedure is more complex, and I don't happen to have step-by-step instructions handy. It can be done, but it might be simpler to back up your personal files from the /home directory, re-install, and then restore your personal files.

0

I'm to lazy to start a Live system, the following is from memory. ;)


Reinstall your system

  1. Boot a Live system
  2. Mount the / partition and backup the following folders: /etc, /var and maybe /opt
  3. If you have no separate /home partition, stop here and go to the the chapter Create a separate /home partition and follow the steps there
  4. Unmount all partitions
  5. Start the installation
  6. In the configuration steps you will see a question about partitioning, eg. something like "Use the entire HDD" and other options
  7. Select "Other"
  8. Define the positions for /, swap and so on and the partition for /home.
  9. For all partitions set format disk but not for /home.
  10. Finish the configuration and use you old username.
  11. Finish the installation
  12. After that you can restore some configurations from the /etc backup and so on

Create a separate /home partition

If there is no separate /home partition, than it's now time to create one.

  1. Backup your existing /home on an external drive
  2. Resize your partition with gparted
  3. Create a /home partition
  4. Move your data back
  5. Go back to the chapter Reinstall your system and continue with point 4
  • I hope this is clear. +1 – Pilot6 Jul 14 '15 at 19:03
  • This procedure assumes the presence of a separate /home partition. There's no evidence from the original post that there is such a partition. If there's no current /home partition, then following this procedure will destroy all current user data! If there is a separate /home partition, then this procedure is much safer. (FWIW, the ability to do this is one of the reasons I generally recommend creating a separate /home partition.) – Rod Smith Jul 15 '15 at 17:13
  • If there is a separate /boot, I guess there is a separate /home too. – Pilot6 Jul 15 '15 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.