Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 8 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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