MacOS – Unable to format Mac internal drive (disk0)

disk-formatdisk-utilitymacosterminal

I have an macbook air late 2008 running osx El capitan and I wanted to erase my driver and reinstall the macos. So first i booted into recovery mode and tried formating my hard dive in disk utility but then I got an error
"MediaKit reports not enough space on device for requested operation" then again I tried the same thing for 3 times and it still showed me the same error. Then I tried formating the drive in terminal but I still get the same error. I tried searching the net and found solutions only for external drive and found no solution for a internal one. So pls tell me a solution to erase and reinstall the os in my mac.

Note: I am trying to reinstall the OS on the primary internal disk that is disk0.

Best Answer

You need to boot from another disk and run disk utility and install from that drive.

You cannot boot from a disk that you want to erase or partition or re-install the system on.