Can't restore Time Machine backup to Macintosh HD Today I found my Mac shut down. It won't boot again anymore.
When I try to turn it on, it just shows the Apple logo, a loading bar and after 1/3 progress it just shuts down again.

After some research I learned how to access the Disk Utility by pressing Command ⌘-R at boot time. Apparently the problem is with the hard disk, since when I try to repair it it says that it can't be repaired and needs to be formatted.

I have an external disk where I backed up the whole system using Time Machine. I'm just not sure how to proceed now.

After accessing the Disk Utility I have 4 options, the first of which is restoring a Time Machine backup. The thing is that if I try this one it lets me restore a backup only in the other partition of the external HD, and not on the disk on my Mac. Why is that? What shall I do?
Since it says you need to reformat, what you need to do is:


Boot into the Recovery Partition
Click "Disk Utility"
Select "Macintosh HD"
Go to the "Erase" tab
Select the format as "Mac OS Extended (Journaled)"
Choose a security option from the security option section(I would recommend zero-pass since this is still your Mac) NOTE: If you have an SSD, the security options button will be disabled. This is normal
Hit "Erase"
It may take a while or be stuck. Don't worry. Give it time. The progress bars and estimated time on OS X suck
After it is done, close Disk Utility and go to "Reinstall OS X"
Select Macintosh HD and then proceed as if you were setting up a new iMac without your old backup