Below steps can be followed to check and cleanup leftover open File descriptors corresponding to deleted files in Linux.
1) Check for the Leftover file descriptors in deleted status and PID using them using below command.
As an example lets assume we see below output.
In this example the file descriptor is on /app/server/bin file which no longer exists. PID 18044 is holding that descriptor.
3) Kill the PID holding leftover file descriptor kill -9 command as follows:
Here PID is the PID from above step 1, in this example 18044.
If the PID is of a app instance or some program process which can be gracefully shutdown, you can even shutdown the process gracefully using the related shutdown commands or scripts.
4) Verify that leftover File Descriptors in deleted status are cleaned using below command.
Products to which Article Applies
1) Check for the Leftover file descriptors in deleted status and PID using them using below command.
lsof -nP | grep '(deleted)'
As an example lets assume we see below output.
# lsof -nP | grep '(deleted)'
bash 18044 root cwd unknown 0,23 /app/server/bin (deleted) (10.10.10.30:/export/common/apps/)
bash 18044 root cwd unknown 0,23 /app/server/bin (deleted) (10.10.10.30:/export/common/apps/)
In this example the file descriptor is on /app/server/bin file which no longer exists. PID 18044 is holding that descriptor.
3) Kill the PID holding leftover file descriptor kill -9 command as follows:
kill -9 <PID>
Here PID is the PID from above step 1, in this example 18044.
If the PID is of a app instance or some program process which can be gracefully shutdown, you can even shutdown the process gracefully using the related shutdown commands or scripts.
4) Verify that leftover File Descriptors in deleted status are cleaned using below command.
lsof -nP | grep '(deleted)'
Products to which Article Applies
No comments:
Post a Comment