I'd like to delete an nginx cache directory, which I quickly purged by:
mv cache cache.bak
mkdir cache
service nginx restart
Now I have a cache.bak
folder which has 2 million files. I'd like to delete it, without disturbing the server.
A simple rm -rf cache.bak
trashes the server, even the simplest HTTP response takes 16 seconds while rm is running, so I cannot do that.
I tried ionice -c3 rm -rf cache.bak
, but it didn't help. The server has an HDD, not an SSD, probably on an SSD these might not be a problem.
I believe the best solution would be some kind of throttling, like how nginx's built in cache manager does.
How would you solve this? Is there any tool which can do exactly this?
ext4 on Ubuntu 16.04
rm
using nice?