To completely erase everything from a classic hard drive, you will need a program such as Darik's Boot and Nuke (DBAN), which securely erases the hard drive until the data is no longer recoverable, according to Germany's Federal Office for Information Technology Security (BSI).
The process is different for modern hard drives with memory chips (SSD) and those that are a hybrid of memory chips and the traditional hard drive (SSHD). In this case, you can use the Secure Erase command, which triggers a deletion routine stored on the hard drive.
If using Secure Erase with the hard drive manufacturer's management software does not work, the BSI recommends Parted Magic as an alternative.
And what about smartphones and tablets? Restoring the factory settings is not enough, according to the BSI. To prevent data from being restored, data encryption should be activated in the settings before you perform the reset. That way, any unerased data will be scrambled and effectively useless.
If the device does not support encryption, another option is to first delete all your data, and then fill up the hard drive with something else – such as a video of a white wall, the BSI advises. Just make sure you don't have any private conversations in the background while the device is recording.
Then delete everything once again and reset the device to the factory settings. – dpa