XK0-004 · Question #46
A technical support engineer receives a ticket from a user who is trying to create a 1KB file in the /tmp directory and is getting the following error No space left on device. The support engineer che
The correct answer is C. the filesystem ran out of inodes.. The 'No space left on device' error can occur even with available disk space when the filesystem has exhausted its inode table, preventing creation of new files or directories.
Question
A technical support engineer receives a ticket from a user who is trying to create a 1KB file in the /tmp directory and is getting the following error No space left on device. The support engineer checks the /tmp directory, and it has 20GB of free space. Which of the following BEST describes a possible cause for this error?
Options
- AThe /tmp directory is not mounted.
- BThe filesystem is formatted with a 4MB block size.
- Cthe filesystem ran out of inodes.
- DThe /tmp directory has been set with an immutable attribute.
How the community answered
(38 responses)- A8% (3)
- B5% (2)
- C68% (26)
- D18% (7)
Why each option
The 'No space left on device' error can occur even with available disk space when the filesystem has exhausted its inode table, preventing creation of new files or directories.
If /tmp were not mounted, attempting to write to it would fail with a path resolution or mount-related error, not 'No space left on device', and the 20GB free space observation would be irrelevant.
A 4MB block size causes internal fragmentation and wastes space for small files, but with 20GB of reported free space remaining the filesystem would still have allocatable blocks and would not trigger a no-space error for a 1KB file.
Every file, including a 1KB file, requires one inode entry to store metadata such as permissions, ownership, and pointers to data blocks. When the inode count is exhausted on a filesystem, the kernel returns ENOSPC (no space left on device) even though data blocks are still available, because no inode can be allocated to represent the new file.
Setting the immutable attribute on a directory with chattr +i prevents modifications to that directory, but the resulting error is 'Operation not permitted' (EPERM), not 'No space left on device'.
Concept tested: Filesystem inode exhaustion causing ENOSPC error
Source: https://man7.org/linux/man-pages/man7/inode.7.html
Topics
Community Discussion
No community discussion yet for this question.