Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
Are we ever allowed to find out how that sentence ended? – Smudge Feb 10 '12 at 10:21
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
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
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


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.