XK0-004 · Question #533
A user deleted a log file because the disk was running out of space on a system running a mission- critical application. Even though the log file was large, the available disk space did not…
The correct answer is D. Option D. On Linux, deleting a file removes only the directory entry; disk blocks are not reclaimed until all open file descriptors to that file are closed, requiring the administrator to truncate the file through the open descriptor in /proc.
Question
A user deleted a log file because the disk was running out of space on a system running a mission- critical application. Even though the log file was large, the available disk space did not increase. The systems administrator determines the following files are still open:
Which of the following should the systems administrator perform to BEST free up disk space?
Exhibits
Options
- AOption A
- BOption B
- COption C
- DOption D
How the community answered
(23 responses)- A17% (4)
- B9% (2)
- C26% (6)
- D48% (11)
Why each option
On Linux, deleting a file removes only the directory entry; disk blocks are not reclaimed until all open file descriptors to that file are closed, requiring the administrator to truncate the file through the open descriptor in /proc.
This option does not address the open file handle held by the running process, so the kernel will not release the disk blocks even if a different action is taken.
This option likely involves restarting the application to close the file descriptor, which is inappropriate for a mission-critical application when a non-disruptive alternative exists.
This option does not correctly locate or truncate the specific open file descriptor that is preventing the deleted log file's disk blocks from being freed.
Option D truncates the open file descriptor by redirecting to /dev/null via the path /proc/<pid>/fd/<fd_number>, which immediately zeroes the file size and causes the kernel to release the underlying disk blocks without stopping the application. This works because the kernel tracks inode reference counts separately from directory entries, so the blocks remain allocated as long as any process holds an open file descriptor, but zeroing the content through that descriptor reclaims the space.
Concept tested: Reclaiming disk space from files with open file descriptors
Source: https://www.kernel.org/doc/html/latest/filesystems/vfs.html
Topics
Community Discussion
No community discussion yet for this question.

