User Tools

Site Tools


filesystem_usage_delete_files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
filesystem_usage_delete_files [2017/10/17 13:30] luke7858filesystem_usage_delete_files [2024/05/23 07:26] (current) – external edit 127.0.0.1
Line 7: Line 7:
 \\ \\
 \\ \\
-1) First we find the file descriptor for the offending file:+1) First we find the file descriptor for the offending file
 +\\ 
 +NOTEyou may be spammed with a lot of files from /tmp/ or similar directorys. Find the appropriate file for your situation. 
 <sxh bash> <sxh bash>
 find /proc/*/fd -ls | grep  '(deleted)' find /proc/*/fd -ls | grep  '(deleted)'
 </sxh> </sxh>
 +Get the file descriptor from the deleted file, it will look similar to: 
 +<sxh bash> 
 +/proc/6755/fd/
 +</sxh> 
 +Once you have this we can delete the file by emptying it. Replacing the following command with the $pid and $fd we got above: 
 +\\ 
 +<sxh bash> 
 +> "/proc/$pid/fd/$fd" 
 +</sxh> 
 +Example: 
 +<sxh bash> 
 +> "/proc/6755/fd/6" 
 +</sxh> 
 +\\ 
 +\\
 \\ \\
 +== JUST ECHO NOTHING INTO THE FILE ==
 +Instead of deleting large files, simpy echo "" into it:
 <sxh bash> <sxh bash>
-lsof | grep 'Deleted'+echo "" > /var/log/httpd/large_access.log
 </sxh> </sxh>
filesystem_usage_delete_files.1508247036.txt.gz · Last modified: 2024/05/23 07:26 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki