Data can be stored on a hard drive for as long as the hard drive lasts.
Even if you store data on a hard drive and remove it from the computer or just leave an external hard drive sitting on your desk or shelf and not power it up the data should be good on the hard drive for years.
In fact if the hard drive is not spinning up or spinning around all the time the hard drive should last longer than one that is in operation and spinning around and around all the time.
Most hard drives that are in operation last on average 5 to 10 years.
At 10 years you should certainly replace the hard drive as it's just a matter of time before it fails.