Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Erase free disk space from the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Erase free disk space from the command line
Authored by: koehn on Apr 24, '08 07:58:49AM

Wouldn't you be much better off using /dev/random instead?

[ Reply to This | # ]
Erase free disk space from the command line
Authored by: ikioi on Apr 24, '08 09:53:20AM

"Wouldn't you be much better off using /dev/random instead?"

No, that would actually be terrible. First of all, you shouldn't fill the boot disk of a running machine because it will cause problems, so the hint is a bad idea anyway. However, if you are anxious to do bad stuff like fill your root drive, then you definitely shouldn't do it from /dev/random, because /dev/random requires vastly more CPU power to generate data for than /dev/zero does. If would take few hours to fill a drive from /dev/zero, but it could take a few weeks to fill it from /dev/random.

Also, I don't know if Mac OS X does this, but Linux will sometimes block on reads from /dev/random while it waits for more genuinely random input from the outside world (say mouse movements, or network traffic rates or some such). (This used to cause "depleted entropy pool" problems for ssl and ssh on linux. Sorry for the "in my day" storry, but I remember when I used to use linux to generate SSH keys and I would have to wiggle my mouse around a lot in order to generate ssh keys in a reasonable amount of time. :-)

[ Reply to This | # ]
Erase free disk space from the command line
Authored by: operator207 on Apr 25, '08 02:35:13PM

Yes, I remember when I setup a FreeBSD server ~5 years ago, I got the standard generating key message you would normally get, then something odd telling me to "wiggle my mouse or hit keys on the keyboard". You feel like an idiot standing at a console in the server room, "wiggling the mouse", and banging on the keyboard, with other admins* walking around asking you if you have gone insane.

Its funny now, not so much back then.

* They were Windows admins, I was the *nix admin at that time.

[ Reply to This | # ]
Yes, it it!
Authored by: RandomMarius on Apr 24, '08 12:34:01PM

Firstly one does not run this as root. run this as a normal user. The system reserves some space for the root user, and this way you will not run out of disk space for critical system. (At least I know this to be true for reiser, ext3 and ext2 filesystems on Linux.

Secondly, anyone paranoid enough to want to do it should never use /dev/zero (Not even when doing it multiple times) since you can still get the data using forensic techniques. Even if you do this multiple times... some drives with advances caching may not even do the successive writes on a very low level (even with only a small sized disk-cache).

Lastly, yes, /dev/random is more cpu intensive... as for a lot more? No it does not:

I did:
(cat /dev/zero > zero &) ; (cat /dev/random > random &) ; sleep 20 ; killall cat ; ls -l zero random

And it showed:

joseki:~ marius$ ls -la random zero
-rw-r--r-- 1 marius staff 222302208 Apr 24 12:27 random
-rw-r--r-- 1 marius staff 666898432 Apr 24 12:27 zero

So, yes, I would suggest using random... a good system-wide anti-entropic engine should be pretty efficient.

[ Reply to This | # ]
Yes, it it!
Authored by: sandrewh on Apr 24, '08 02:30:10PM
I would think that this could be equally useful using /dev/random or /dev/zero. ramdom would help obscure old data from disk searches. zero would allow for the raw partition to be more easily compressed.

[ Reply to This | # ]