The data storage that lasts the longest is Archival M Discs which are optical discs which are made with materials that resist UV light and moisture and it's said that they could last up to 1,000 years.
M Discs are available in different storage capacities.
Cloud storage is also another good option for long term data storage and some cloud storage providers also offer multiple backups.
External hard drives are also good to store data for long term use.
To keep your data safe for years you should keep multiple copies of the data in multiple locations and treat and store the data devices well.
Most hard disk drives last 3 to 5 years although they can also last longer than that.
Solid state hard drives tend to last 5 to 10 years before they go bad.
Although I still have a 20 year old hard drive that is the old hard disk drive with the spinning platter that is still working in a 20 year old computer.
I use it mainly for viewing photos with and it has worked great so far.
I stil have the data backed up on other drives as well.
If you're using a SSD or solid state hard drive you should plan to replace it within 10 years or sooner.
However as long as you have your data backed up on other drives and even online so that you don't lose the data you can wait until it fails.
I always keep multiple backups of my data around including on multiple flash drives, online file storage, on portable hard drives etc.
Any important data you have should be backed up in multiple locations to prevent data loss.
Hard disk drives that have moving parts may go bad quicker than a solid state drive that has no moving parts.
However even solid state hard drives may go bad sooner than a hard disk drive that has moving parts.
How often you use the hard drive will also impact it's lifespan and if you make a lot of videos, store a lot of data or take a lot of pictures you may need to upgrade to a bigger hard drive before the hard drive actually fails.