D
D
Dmitry2020-12-11 16:21:42
linux
Dmitry, 2020-12-11 16:21:42

How to delete files in Linux without slowing down the computer?

Due to crooked settings, a folder with several million files was formed.
Rm -rf of course deletes it, but the web server on the same computer is wildly stupid at the same time periodically falling into a 502 error.
And it would be fine if it was deleted quickly, but in 15 minutes the deletion process did not even think to end.
Is there any way to delete it in the background without rebooting the computer?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Kharchenko, 2020-12-11
@demon416nds

These questions have been studied for a long time and here are a couple of articles on Habré, there are almost all known solutions, read:
Unusual hard disk overflow or how to remove it ...
So how do you delete millions of files from one folder?

M
mayton2019, 2020-12-12
@mayton2019

If files are cleaned on a regular basis, then it makes sense to make this folder a disk and connect it via fstab. For cleaning - umount + mkfs + mount. Takes seconds.
Also, pay attention to the file system type. For example zfs deletes slowly. Might be worth switching to ext4.

A
Alexander Lykasov, 2020-12-11
@lykasov-aleksandr

As an option - make a script that will delete one file at a time and pause.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question