As others have mentioned, not a good idea to do this from a drive in use.

There's a couple problems.  Binaries are loaded into memory as the execution hit's an address that's on disk and not in memory, called a page fault.

So sshd for instance when runs will generate a bunch of page faults, but those pages in memory can be paged out if needed for something else.  So say you are happily wiping your disk, a new ssh connection is attempted from some network scan.  It might trigger a page fault, if that page doesn't exist on disk it might well crash, which might well terminate your connection and your disk would be partially wiped AND likely not bootable.

After your dd you might want to use hdarm --security-erase explained at:
https://grok.lsu.edu/article.aspx?articleid=16716



Other problems can be swap, you might zero out all of swap, then have parts of ram paged to disk again, leaving part of your disk unwiped.

So boot from whatever media you have, then wipe the disk.

So this isn't a bad idea:
  $ dd if=/dev/urandom of=/dev/sda bs=1M

But keep in mind that unreliable sectors might still be readable and not overwritten by the DD.  The chances are small, but there.






On 2/3/24 12:36, Bob Scofield wrote:
Hi,

I want to recycle an old desktop. I'm planning to wipe the hard drive with this command:

dd if=/dev/urandom of=/dev/sda bs=1M

Can I just run this from the command line? Or do I have to use a flash drive with Linux on it and run it from the command line of the Linux on the flash drive?

Thanks.

Bob
_______________________________________________
vox-tech mailing list
[email protected]
http://lists.lugod.org/mailman/listinfo/vox-tech



_______________________________________________
vox-tech mailing list
[email protected]
http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to