1. Identify Open Files
Use the `lsof` command with a grep filter for deleted files, for example:
Code: Select all
lsof | grep 'deleted'
Code: Select all
lsof | grep 'deleted' | grep '/home'
2. Locate the Process
Each open file entry includes details such as the process name (e.g., `bash`), the process ID (PID), and the file path. In the example:
Code: Select all
bash 22436 pollmann_m24 1w REG 8,1 18751014 427679 /home/somefile... (deleted)
3. Kill the Process
Once you have identified the process causing the issue, you can terminate it using the `kill` command:
Code: Select all
kill 22436
4. Confirm the File is Released
After killing the process, run `lsof` again to confirm there are no longer references to the deleted file. Once there are no open file descriptors referencing it, the file is fully released from the disk.
This quick fix ensures that deleted files don’t consume unnecessary space on your system. Always double-check before killing processes to avoid stopping important services or sessions.