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.

link|improve this question

55% accept rate
feedback

2 Answers

up vote 6 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/null of=/tmp/tempFiller.deleteMe bs=1M count=$COUNT

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

Edit: Added the tip of Janne to increase the block size.

link|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
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.