You can check if there were sectors reallocated with smartctl
(look at Reallocated_Sector_Count, the last column is the raw value).
If your harddisk supports the security feature set, you can issue a SECURITY ERASE UNIT
command in enhanced erase mode, which will also erase reallocated user data (see p. 215). However, this command will also erase all other data.
The tool hdparm
can be used to perform such an erase.
I'm not aware of any standardized protocol to get a list of reallocated sectors from a harddisk, or to access the reallocated sectors directly (after all, they are reallocated, so they don't have any LBN associated with them anymore).
You want to be able to use the disk afterwards, or not? Destroying the data with the disk is quite straightforward. Keeping the disk alive is a more difficult proposition. – Ecnerwal – 2016-12-28T03:09:38.260
I definitely plan on keeping it. I just want to wipe all old data for security reasons. – user138072 – 2016-12-28T03:26:48.097
Is there no command or program I can use to access remapped bad sectors? If doing such a thing is impossible from the OS, then I'll move on. – user138072 – 2016-12-28T04:04:24.060
I don't know if there is such a command, off the top of my head. When there has been a security concern with old data at my workplaces, the price of the hard-drive was not a concern and physical destruction was and is the approach we have taken and do take. Someone else may know a method, or not. Give it some time. – Ecnerwal – 2016-12-28T04:08:46.903
I don't believe this is possible with normal software. It may be possible with special software used by data recovery professionals. The cost for such is out of reach for normal users. If you are that concerned about security physical destruction is probably a better option. – LMiller7 – 2016-12-28T04:38:23.747
To clarify, I am not concerned about it to such a degree that I would destroy the hard drive. In fact I'd probably be fine leaving it as it is. But I saved data to the drive unencrypted. Hence if securely erasing that data (if bad sectors have been remapped - I don't know if they have or have not) is possible in Linux, then I'd like to know. I'll wait for more responses... – user138072 – 2016-12-28T05:32:13.977