Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Might be a stupid question, but what would be the worst for your system ? (I think both) But to my opinion mv would be the fastest to "delete" it all. Am I wrong ? (don't wana test aniway ^^ )

share|improve this question

migrated from Jul 1 '13 at 15:03

This question came from our site for professional and enthusiast programmers.

usually I do mkfs.ext3 /dev/sdx# would it be faster than rm/mv ? – Kent Jul 1 '13 at 14:01

I'd go with the first option because mv -r / /dev/null won't work:

$ mkdir A
$ mv -r A /dev/null 
mv: invalid option -- 'r'
Try 'mv --help' for more information.
$ mv A /dev/null 
mv: cannot overwrite non-directory ‘/dev/null’ with directory ‘A’

Not to mention that you can't move a directory like / into a subdirectory under itself.

If this is a serious question, why do you bother unlinking the data? For most purposes you can just recreate the file system.

share|improve this answer
even mv /tmp/xyz /dev/null gave me overwrite? warning; /tmp/xyz being a directory. – anishsane Jul 1 '13 at 14:59

dd is the command you need:

dd if=/dev/urandom of=/dev/sda

Then it is unrecoverable overwritten. Remark: You may possibly still recover something with a tool like Spinrite, Steve Gibson claims that it can recover data from overwritten blocks using the rest magnetism of the previous write operation.

Another free CLI tool with a more fancy interface, that does several custom overwriting passes is DBAN

share|improve this answer
i hope the OP is asking for the best command to wreck a havoc on his system out of the two options he has. – Ashildr Oct 8 '13 at 14:07
Completely unrecoverable, except for all the data on the disk after the length of the image, which can range from nothing to several tebibytes. – Blacklight Shining Dec 16 '15 at 10:05
i have an improvement: dd if=/dev/random of=/dev/sda – jringoot Dec 22 '15 at 15:38
@jringoot If you want to improve your answer, edit it rather than posting a comment. – Blacklight Shining Dec 22 '15 at 20:05
Not /dev/random; that'll be very slow on Linux systems. If your goal is to quickly render the data on a disk unrecoverable without destroying the disk (and you didn't encrypt the whole thing to begin with), your best bet is probably to overwrite it with zeroes: so far, no one's publicly announced the ability to recover data once it's been overwritten even just once (and there is|was a bounty, too). If you've got time after that, you can run more passes on it. If you want the disk filled with random data, use /dev/urandom—the randomness doesn't need to be really cryptographically strong. – Blacklight Shining Dec 22 '15 at 20:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .