XK0-005 · Question #110455000
An administrator receives a warning about a file system filling up, and then identifies a large file located at /tmp/largelogfile. The administrator deletes the file, but no space is recovered on…
The correct answer is A. lsof | grep largelogfile. On Linux, deleting a file removes its directory entry, but the disk blocks are not actually freed until all open file descriptors referencing that file are closed. If a process still has the file open, the kernel keeps the data on disk. 'lsof | grep largelogfile' lists all open…
Question
Options
- Alsof | grep largelogfile
- Bpkill /tmp/largelogfile
- Cpgrep largelogfile
- Dps -ef | grep largelogfile
How the community answered
(23 responses)- A78% (18)
- B13% (3)
- C4% (1)
- D4% (1)
Explanation
On Linux, deleting a file removes its directory entry, but the disk blocks are not actually freed until all open file descriptors referencing that file are closed. If a process still has the file open, the kernel keeps the data on disk. 'lsof | grep largelogfile' lists all open file handles and filters for the deleted file, revealing which process is still holding it open. Once that process is identified and restarted or the file handle is closed, the space will be reclaimed. pkill and pgrep operate on process names, not file paths, and would not identify the correct process. ps -ef lists processes but does not show which files they have open.
Topics
Community Discussion
No community discussion yet for this question.