Create an EFI partition
Googling the error message I get a plethora of different causes: e.g. no space on the main volume, broken SATA cables etc.
So restoring or rebuilding the EFI partition probably won't solve your problem.
Recreating a/the EFI partition should be easy though:
- Create some OS X installer thumb drive
- Detach your external drive
- Boot to the thumb drive.
- Open Terminal in the menubar > Utilities
- Enter
diskutil list
to get the disk identifier of your internal disk (probably disk0) - you will get about 12-14 disks almost all of them related to the thumb drive. Check the sizes to get the right one - below I assume it's disk0. - Unmount disk0 with
diskutil umountDisk disk0
-
Check partition table:
gpt show -r /dev/disk0
-
Remove the two existing partitions:
gpt remove -i 1 /dev/disk0 gpt remove -i 2 /dev/disk0
-
Create a new partition and re-add the other two:
gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0 gpt add -i 3 -b 1952255592 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC /dev/disk0 gpt add -i 2 -b 409640 -s 1951845952 -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk0
-
If the disk is stubborn destroy the gpt and a add a new one:
gpt destroy /dev/disk0 gpt create -f /dev/disk0
Now repeat the previous step and add the three partitions.
- Attach the external drive
- Get the disk identifier of the external drive with
diskutil list
(probably disk14 or even higher - below I assume it's disk14) - Unmount disk0 with
diskutil umountDisk disk0
- Unmount disk14 with
diskutil umountDisk disk14
-
Clone the EFI partition of the external drive to your internal drvie with:
dd if=/dev/disk14s1 of=/dev/disk0s1 bs=1m
- Enter
reboot
to reboot your Mac