I have a list of directories that I'd like to delete. However when I do them all at one, load spikes on the box. Does anyone have an example of a script that would wait until load was under a certain level before proceeding with the deletion (interation of the loop)
Better still, use
This'll cause your delete command only to run when the disk IO is free, so it has the lowest priority. Cyberciti has a nice little article on all the variants you have, and how to use them.
|show 1 more comment|
There is a good write up here http://www.depesz.com/2010/04/04/how-to-remove-backups/ on a systematic controlled approach.
Changing the io scheduler, removing journals, atime and diratime are also contributory factors. There is also a different deletion binary
Don't try this at home
A while ago, we were testing faster deletion methods of deletion for terabytes of data. In the end it actually proved quicker to start a
It worked surprisingly well and far quicker than a traditional delete - but I would never ever do it on a production system. Ever.