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.

On a system with linux there are 2 folders with aprox 12gb used(out of 500gb) and all inodes are used by some s

share|improve this question
1  
How many files are we talking about? –  Bart De Vos Feb 10 '12 at 10:02
    
i can not count them with any commend. the number of filer are really big because they used all inodes references –  Bogdan Cosmin Feb 10 '12 at 10:17
5  
Are we ever allowed to find out how that sentence ended? –  sam Feb 10 '12 at 10:21

1 Answer 1

up vote 4 down vote accepted

If you're on a relatively recent box just using something like

find /my/full/directory -type f -delete

You can be a little bit more subtle if you want to delete only some of the files by throwing in a pattern match.

Don't use find with xargs and rm, as this will spawn a new process for each group of files xargs passed to rm thus making it take even longer to complete.

share|improve this answer
    
i'l try this, thanks....hope it works –  Bogdan Cosmin Feb 10 '12 at 10:18
    
The whole point of xargs is that it does not spawn one process per file. –  JdeBP Feb 10 '12 at 10:47
    
@JdeBP xargs may however complain about having too many arguments. –  Andrew Feb 10 '12 at 10:49
1  
Not had my caffeine fix this morning. Xargs will group the output of find and fork, exec rm for each group. With zillions of files this'll still be an overhead. On any case, this is likely to take a fair while if all the inodes have been used as one per file. –  goo Feb 10 '12 at 11:03
2  
The amount of overhead in fork+exec is going to be dwarfed by the amount of (synchronous) disc I/O involved in unlinking all of those directory entries (zeroing bitmaps and so forth). And the program image for /bin/rm will be cached. You've latched onto something that isn't actually a problem. The thing that you've entirely missed, on the other hand, is the safety risk of using xargs instead of -execdir. Interestingly, the manual is silent upon whether -delete has the same safety hole with pathnames that -print0|xargs -0 /bin/rm -- does, or whether it uses unlinkat(). –  JdeBP Feb 10 '12 at 12:30

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.