[CentOS] Fastest way of removing very large number of files?

Dennis Jacobfeuerborn dennisml at conversis.de
Fri Aug 23 10:40:51 UTC 2013


On 23.08.2013 07:52, Xinyun Zhou wrote:
> On Thu, 2013-08-22 at 23:40 -0600, Frank Cox wrote:
>> On Fri, 23 Aug 2013 07:34:50 +0200
>> Rafał Radecki wrote:
>>
>>> Can you recommend something? I use an ext4 filesystem.
>>
>> Without actually trying to to see, I suspect that a C program that calls
>> remove() would probably be faster than just about anything else.
>>
>
> I agree with what you are saying, and I think you may even want to use
> unlink() if they are all files, no dirs. remove() actually will call
> unlink() so you may be able to save few function calls and logical
> statements.

I doubt saving functions calls is going to gain you anything in this 
case as 99.9% of the time the rm takes is on disk I/O. If you want to 
reduce the rm time you have to find a way to reduce the disk I/O it 
requires.

Regards,
   Dennis




More information about the CentOS mailing list