Junior — Middle
What steps should be taken if disk space is not freed after deleting files in a Linux system?
sobes.tech AI
Answer from AI
If the free space in Linux does not increase after deleting files, it is likely that the files are still held by processes. This happens when a file is deleted from the filesystem, but its descriptors are still open.
What to do:
- Use the
lsof(list open files) command to find processes that hold deleted files:
lsof | grep deleted
- Find the PID of the process holding the file, and restart or terminate it:
kill -9 <PID>
- After this, the space will be freed.
Alternatively, you can use fuser to find processes using a specific directory or file.
Also, check that the deletion actually occurred on the correct filesystem and that there are no mounted points hiding files.