Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have to remove many directory. but

rm -r /data

is so slow ( about some days) /data has

/data/a/b/c/d/e/f/g/h ....

many dirs

Does anyone know?

share|improve this question
    
Is \data perhaps a separate file system? –  Bart De Vos Oct 28 '11 at 8:28
    
serverfault.com/questions/183821/… –  quanta Oct 28 '11 at 8:29
    
serverfault.com/questions/296032/… –  quanta Oct 28 '11 at 8:29

1 Answer 1

Removing huge amount of files and directories is a long operation, no matter what file system you have in use. Depending on your I/O subsystem and file system it might help performing the removal in parallel; just put one rm process removing directories starting with a-f, another one with g-n, and third one with o-z. Or something like that.

Or if it's OK for you to just have file removal going on background, you can always

mv data data_to_be_removed
mkdir data
rm -rf data_to_be_removed
share|improve this answer
1  
Just what I was in the process of suggesting, Janne - I completely agree with you. Computers are there to do hard work that takes time, so we don't have to. mv the file system to one side, then rm -rf can be happily chewing through it freeing up disc while you get on with putting your new content in place. –  MadHatter Oct 28 '11 at 8:39

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.