I have a complex directory structure with lot of small files in it. like: /opt/data/1000/45/32/2009/10/15/76543.zip

When I launch a "du" or "find" on this directory (/opt/data/) my server load increases a lot (0,5 --> 25) and my system doesn't respond any more.

Can I "slow down" the execution of the du/find command to keep my system accessible? I don't care if the command takes 3 days to run :-) I've tried with "nice -n 19" with no success...

Thank you !

link|improve this question

I'm not 100% sure, but the problem is that DU is disk I/O intensive, and I think NICE will only prioritize CPU resources. I don't really have an answer, but I though that this comment could help. – Bob Rivers Dec 3 '09 at 15:15
yes bob, you're right. the problem is I/O... – Matthieu Dec 3 '09 at 15:29
feedback

2 Answers

up vote 6 down vote accepted

You could use "ionice" to be more gentle to the system.

Ex:

$ ionice du /opt/data

You can even set the io scheduling on a pid:

$ ionice -c 3 -p 1023

See man page for more info on how to use "ionice"

link|improve this answer
+1, I didn't know ionice existed! Very nice! – pauska Dec 3 '09 at 15:14
Thank you! I've tried... but nothing change. Note: this tool is in debian "schedutils" package. – Matthieu Dec 3 '09 at 15:31
feedback

I would do both ionice and nice:

So after running ionice, then run renice:

renice -n 20 -p 1023

You could also just launch the process with nice in the first place.

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.