Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Create text files recursively and write ZEROS within them all - data overwriting purposes

by jcb (Parson)
on Dec 30, 2015 at 04:53 UTC ( #1151431=note: print w/replies, xml ) Need Help??

in reply to Create text files recursively and write ZEROS within them all - data overwriting purposes

While Perl can do what you want, filling slack space with garbage files is not a sound media-wiping method, especially on Windows.

You mention that you often have Windows machines sitting idle. An idle Windows box can be temporarily converted into a Linux box using a live CD, then you could use dd or shred to overwrite the entire media.

For a modern hard disk, badblocks in write mode on the entire disk should be enough to scrub it clean, unless there are reallocated sectors. After running badblocks, use the smartctl command to list the SMART attributes and look for "Reallocated_Sector_Ct". If the raw value is zero, congratulations, your drive has not grown any bad sectors. Otherwise, the drive should probably not be trusted to actually hold data any longer and some of the data you want destroyed might be on a sector that the drive has remapped. Physical destruction of the entire drive is probably a good idea in this case, since it can no longer be trusted to hold data.

For an SSD, you need to consider the effects of wear-leveling and possibly data compression. In this case, multiple runs of dd if=/dev/urandom of=/dev/SSD should be enough to ensure that every block is overwritten at least once, but you should really use a special tool that issues a Secure Erase command to the drive. I have no experience with these.

A much better option is to use disk encryption, like LUKS/dmcrypt in Linux. If the entire contents of the drive are encrypted, you will only need to worry about destroying the key, which should be much easier, but you will lose the data if you lose the key before you are ready to destroy it.

There is a fundamental trade-off between confidentiality and availability. Consider how valuable having the data is to you and your clients, how valuable the privacy of that data is to you and your clients, and how valuable having that data would be to third-parties that you and your clients do not want to have it.

  • Comment on Re: Create text files recursively and write ZEROS within them all - data overwriting purposes
  • Select or Download Code

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1151431]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2023-10-01 19:03 GMT
Find Nodes?
    Voting Booth?

    No recent polls found