How to install the OS with a new Hard drive?

I've just bought my first Mac, a Macbook pro(with an hdd), and I'm thinking in buying an ssd and replace the hdd. But the computer came with no dvd of the OS. I know that in the hdd there is a restore partition, but if I remove the hdd, how can I install the OS?


You can create your own recovery disk with Recovery Disk Assistant and a blank USB drive that is at least 1 GB. Alternatively, your Mac can boot into OS X Internet Recovery mode in which it downloads an image from Apple's servers, and it can do this with a damaged recovery partition or even a blank hard drive -- it's built into the firmware of the system. To access it, boot up while holding Command + R. You can do this over a wireless network that is either unprotected or WPA-secured, or you can use an Ethernet connection. In both cases, your system will need to download OS X from Apple (the recovery partition does not contain a full OS X.)