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

I need a script to fill up my diskspace on my Linux box. It would be best if I can leave 200 MB free. I have Nagios installed, and it should email me when something like this happens, but how do I test it?

I have Perl and PHP installed so if you want to use that then sure.

share|improve this question
up vote 9 down vote accepted

Disclaimer: I'm not responsible if this screws your system in any way... just saying...

Something like this should work:

dd if=/dev/zero of=/tmp/tempFiller.deleteMe bs=1M count=$COUNT

$COUNT needs to be replaced with how big the file should grow in MiB.

share|improve this answer
    
I'm going to test on my VM box FIRST! (but not now. i am pleasantly surprised how fast this was answered) – acidzombie24 Sep 29 '10 at 13:11
4  
You can make dd perform a lot faster by using a bigger block size. Try with dd if=/dev/zero of=/tmp/tempFiller.deleteMe bs=1M count=$COUNT, where $COUNT is size in megabytes. – Janne Pikkarainen Sep 29 '10 at 13:18
    
@Janne: Thank you, edited my answer. – Bobby Sep 29 '10 at 14:43
    
bs, not ibs. bs sets both ibs (input block size) and obs (output block size). – Cristian Ciupitu Feb 19 '11 at 13:53

It can also be done by:

dd if=/dev/zero of=/tmp/tempFiller.deleteMe ibs=1M count=$sz

If any one can answer what if ibs=1M is replaced by bs=1M.

share|improve this answer

You must log in to answer this question.

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