macbook doesn't recognize internal HDD, only when connected via USB yesterday something weird happened. After my 13' macbook pro ( early 2011 ) was running all night while playing music, in the morning I just closed it and went home from my friends house. When I got home and opened it, it just froze completely, so had to shut it down with the power button. After turning it back on, it just showed me this folder with a question mark. When I tried to do internet recovery, I couldn't, because no HDD was visible. So I couldn't do anything at all, even in DISK UTILITY computer wouldn't show any disk at all. So I took the lid off and disconnected my HDD and put it in enclosure and connected it to my macbook via USB and booted from there. It booted perfectly fine, as nothing happened.I did time machine back up just in case something will go wrong again. SO, basicly it will boot from USB but not when the HDD is actually inside my macbook. Any advice ? I read some forums and it looks like it could be HDD's controller that failed, disconnected HDD's power source, disconnected HDD's date cable,SMC, NVRAM, or PRAM need to be reset, the drive's indices are corrupt, a logic board problem exists .. Just wondering if anybody had similar problem and could give me some advice. Another thing, my macbook was overheating a lot and after I opened it, there was quite a lot of dust. 
Also I want to ask, if I will buy a new HDD ( looking at Seagate Momentus XT 750 GB ), can I get it all look like my old system. Do I just plug in my time machine disk ? Sorry I am not very good at this technical stuff. Thanks a lot for any help.
It's probably the flex cable that connects the hard drive to the logic board. Some of the cables inexplicably went bad in 13" MacBook Pros--happened in my 2009 model. A new cable for my model was $9-$11 for the part at an Apple Store, and I got the tech to waive the labor charge since the part was so cheap. Looks like the cable for the 2011 models is $50 on ifixit (http://www.ifixit.com/Store/Mac/MacBook-Pro-13-Inch-Unibody-Model-A1278-Early-2011-Late-2011-Hard-Drive-Cable/IF163-026). Not a difficult repair at all if you're already out of warranty and would rather do it yourself, but use a nylon probe tool (black stick, can also be purchased from ifixit or elsewhere) to disconnect the battery from the logic board first and then carefully remove the cable connector from the logic board--don't want to break the logic board side. 

As far as overheating goes, the system will shut itself off or put itself to sleep if it gets above a safe operating temperature. If fans are running all the time, it could be something software related (runaway process, web video, CPU/graphically intensive app). If the fan and outtake vents are blocked with dust, could also be a lack of airflow. You can use compressed air (only hold the can upright) to blast out the dust when the bottom cover is off. Or if you take it to an Apple Store just ask the tech to clean up the dust.