-2

I am wondering what the result of the above command will be. My goal is a command that will first delete all files on the disk and then overwrite the disk with zeros. However I am concerned that the rm part of the above command will delete the files necessary to run the dd command (such as /dev/sdX). What will the result of the above command be and if it does not do what I described how could it be improved?

  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. Also see [Where do I post questions about Dev Ops?](http://meta.stackexchange.com/q/134306) – jww Jun 06 '17 at 02:34

2 Answers2

-1

You don't need the rm -rf / (read about page cache)

Just do the dd if=/dev/zero of=/dev/sdX bs=64k (with an appropriate X letter). Then reboot without sync

If you really are paranoid, do the dd from a live USB linux. If you are even more paranoid, destroy physically the disk afterwards (e.g. with a hammer).

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
  • 1
    Back in the olden days, we would overwrite the disk with all zeros, then all ones, then a repeating pattern of 010101010101...., then a repeating pattern of 10101010101.... Repeat that cycle 100 times. Smash the disk. Burn the pieces. We weren't messing around. – Jack Jun 06 '17 at 02:47
-1

If you just dd the disk with zeros there's going to be no files left anyway.

There is a small chance that if linux doesn't completely load any libraries completely from the disk before you zero them you'll run into problems as they just load zeros instead of the required code, but I suspect in this case linux would have loaded the entire "dd" executable into memory and any required libraries almost immediately.

But to be sure, run it from a live USB linux.

Also when it comes to preventing data recovery writing over with zeros isn't foolproof (although it does stop someone just picking the disk out of the bin and loading it, it may not stop well resourced attackers). If you really want to stop data recovery you're better off overwriting it with random data. And if you're really really want to be sure write it over with random, then ones and zeros, and do that a number of times.

Clinton
  • 22,361
  • 15
  • 67
  • 163