The difference is a hard drive stores data with tiny magnetic charges. These charges can be changed to reflect if data is stored at a particular point or not. CDs and DVDs have the data physically burned into them by a laser. In some cases, discs were made that can be re-written, but there is a very low limit on how many times you can do this. You can only burn holes in something so many times before it's destroyed.