I upgraded my ram about three months ago and then it had random restarts, then I checked disk utility to that my main hardisk wasn't good and couldn't be repaired. But then I did a safe boot and again everything was normal. Then after 3 days again random restarts, safe booted and everything was fine then finally after 3 days it randomly restarted and didn't boot. Mean while o had installed el Capitan beta 1 on another partion. Then I installed Yosemite on a SD card from my friends Mac book and booted from it on my Mac. Everything seemed fine. I backed up data and reinstalled osx on it. Till today everything was fine of reinstallation of osx when suddenly I restarted. I tried to do a safe boot and restart but after safe boot when I clicked restart while restarting it would show a prohibitory sign then the apple logo then again the prohbitory sign and again apple logo and again prohibitory sign and apple logo with loading bar but it won't boot into my main hard disk bit into the El Capitan partion and even if I try to hold option while booting and select main disk it does the same dance and boots into El Capitan. What should I do?
You did a lot of installing of operating systems including installing a beta version of an operating system; which, by the way, is not in any way an accepted method to diagnose issues.
However, I noticed you never addressed the single causality that probably is the issue:
I upgraded my ram about three months ago and then it had random restarts,
- Have you tried resetting you NVRAM?
- Have you tried removing the RAM you installed?
Those would be the first two steps I would take before I embark on a OS installation and re-installation journey.
My first thought would be that you pull the drive, put it in an enclosure and try to reformat it from another system.
Or just get a new drive and try installing fresh.
The other issue could be bad ram assuming you checked the ram you bought was fully compatible. I did but knockoff ram once that said it was all good but turned out not to be.