Apple Macbook Pro backup question

If I use Time Machine to backup all the data...for all users, and the settings on my MacBook pro,  my understanding is that I would be able to recover that information in the event I needed to restore that information.  However, if the computer hard drive fails to function and I have to replace the hard drive (the operating system at this time is Yosemite 10.10.2) I am assuming that I would replace the hard drive with a new hard drive.  How do I replace the operating system as I do not have any disc for the OS called Yosemite?  Do I just go to the Apple Store and download Yosemite and install it?  I am assuming that my Apple ID would make this possible but I am not sure.  Also, one related it possible to do a system image of the hard drive with Time Machine?  My impression is that Time Machine is good at backing up data but the folks who talk about Time Machine do not promote doing a system image with that software.
Who is Participating?
It depends on how badly the HD fails. If it is simply badly corrupted you can restart into the Recovery Partition by booting while holding down Command-r, then erase and reformat the main partition and recover your data and operating system using Time Machine.

If the hard drive has a mechanical failure so that the recovery partition is not available, then you may have re-install using Internet Recovery:

However it is a good idea to have an external bootable drive available for emergencies and you can make a bootable clone of your drive using the built-in Disk Utility following these instructions:
Gerwin Jansen, EE MVETopic Advisor Commented:
You can re-install OSX from internet:
(or from Time Machine as the initial backup is the complete system).
capreolAuthor Commented:
Thanks for your advice.  Much appreciated.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.