filesystem_usage_delete_files
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| filesystem_usage_delete_files [2015/07/02 08:18] – created luke7858 | filesystem_usage_delete_files [2024/05/23 07:26] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | == Clearing Deleted Files WITHOUT an Application Restart == | ||
| + | Ever deleted a file and wondered why the disk space hasn't cleared? | ||
| + | \\ | ||
| + | Chances are the application is still keeping the old file open. | ||
| + | \\ | ||
| + | One way to " | ||
| + | \\ | ||
| + | \\ | ||
| + | 1) First we find the file descriptor for the offending file. | ||
| + | \\ | ||
| + | NOTE: you may be spammed with a lot of files from /tmp/ or similar directorys. Find the appropriate file for your situation. | ||
| <sxh bash> | <sxh bash> | ||
| - | lsof | grep 'Deleted' | + | find /proc/*/fd -ls | grep '(deleted)' |
| + | </ | ||
| + | Get the file descriptor from the deleted file, it will look similar to: | ||
| + | <sxh bash> | ||
| + | / | ||
| + | </ | ||
| + | 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> | ||
| + | > "/ | ||
| + | </ | ||
| + | Example: | ||
| + | <sxh bash> | ||
| + | > "/ | ||
| + | </ | ||
| + | \\ | ||
| + | \\ | ||
| + | \\ | ||
| + | == JUST ECHO NOTHING INTO THE FILE == | ||
| + | Instead of deleting large files, simpy echo "" | ||
| + | <sxh bash> | ||
| + | echo "" | ||
| </ | </ | ||
filesystem_usage_delete_files.1435825101.txt.gz · Last modified: 2024/05/23 07:26 (external edit)
