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.