A Linux application can fail to create a file even when its disk has free gigabytes. Check the filesystem containing the failing directory, then compare its free blocks with its free inodes. If the inode count is exhausted, deleting one large archive may recover bytes while doing almost nothing for the number of new files the filesystem can hold.
This guide is for administrators of a Linux VPS or dedicated server using GNU coreutils. It investigates a specific file-creation failure. It does not assume that every “No space left on device” message is an inode problem, and it does not provide a blanket deletion command.
1. Identify the exact destination that failed
Start with the application error and the destination directory. A failed upload, temporary-file write and log rotation can use three different mounts. Record the time, service account and path before changing anything. Use an existing parent directory if the intended file was never created.
WC_PATH=/var/www/example-site
findmnt --target "$WC_PATH" --output TARGET,SOURCE,FSTYPE,OPTIONS
df -h -- "$WC_PATH"
df -i -- "$WC_PATH"Replace the example path. These commands inspect the mount and capacity; they do not remove files. GNU df documentation distinguishes block usage from inode usage. The findmnt manual explains how --target identifies the filesystem for a path. A root filesystem result is not enough when the application writes to a separate volume or container mount.
2. Interpret the two capacity measurements together
Observation | What to investigate next |
|---|---|
Free bytes remain; IFree is zero | File-count capacity is exhausted on this filesystem. Identify the file producer and largest inode consumers. |
Free bytes are near zero; inodes remain | Investigate byte consumption and filesystem reserves before assuming a file-count problem. |
Both appear healthy | Check the account quota, the exact failing mount, permissions and the full error. Do not infer an inode fault from the message alone. |
Inode statistics are unavailable or unexpected | Confirm the filesystem type. Not every filesystem reports or allocates inodes in the same way. |
Illustrative example: a filesystem with 18 GiB free but zero free inodes can reject a new session file. A directory full of tiny cache entries is a plausible suspect. That example is a diagnostic pattern, not a measurement from WebCare360 infrastructure.
3. Count within a bounded directory
Start with the affected application tree instead of scanning the entire server during an incident. A directory traversal can cause noticeable disk work even though it is read-only. Run at a suitable time, and stop if it interferes with the service.
sudo du --inodes --one-file-system --max-depth=1 -- "$WC_PATH" | sort -nGNU du can count inodes instead of bytes. The one-filesystem option avoids descending into mounts on another filesystem; maximum depth controls the displayed totals, not how much of each subtree must be traversed. Permission errors make the result incomplete. Use an account authorized to inspect the relevant tree and do not hide those errors. See the GNU du options.
Repeat the command on the largest relevant subdirectory. Look for the application responsible for creating entries: file-based sessions, generated thumbnails, caches, a mail queue or a failed job repeatedly writing tiny outputs. A high count identifies where to investigate; it does not establish that the files are disposable.
4. Recover capacity through the owning application
Confirm the affected directory and whether its files are authoritative data, rebuildable cache, queued work or evidence that must be retained.
If a runaway producer is identified, pause only that job through its normal controls. Record the action so it can be resumed deliberately.
Use the application’s documented retention or cache-cleaning mechanism. Inspect its scope and dry-run facility where available before applying it.
Move necessary retained data to a verified different filesystem or backup destination. Renaming a directory within the same filesystem does not free its inodes.
Check free inodes again, then verify a normal application operation as its actual service account. A root-only write check is not enough.
Do not remove database files, active upload directories or queued messages simply because they contain many entries. Do not format a filesystem to change its layout during a capacity incident. If retention is unclear, preserve the data and involve the application owner.
5. Investigate mismatched accounting
Deleted files may remain allocated while a process still has them open. The GNU coreutils FAQ explains why df and directory totals can disagree. Inspect the responsible process before scheduling a controlled restart; restarting every service loses diagnostic context and can interrupt healthy applications.
If only one hosting account fails, ask for its effective inode and storage quota instead of relying on whole-server free capacity. In a container, compare the mount inside the application’s namespace with the host view. Escalate a persistent mismatch with the exact path, filesystem type, error and timestamp, without sending private file contents.
6. Prevent the same failure from returning
Record both free bytes and free inodes for the affected mount, together with how quickly the file count grows. Set the warning level to leave enough time for your cleanup or capacity process. A cache that refills immediately needs a producer or retention correction, not a recurring emergency purge.
If you are planning a new environment after diagnosing the capacity problem, compare our Linux and managed VPS options by operating responsibility as well as storage allocation. Confirm the filesystem and account limits for the destination, using your measured file-count growth. More advertised gigabytes alone do not prove that an inode limit has been resolved.
Close the incident when the original operation succeeds, the responsible job is under control and the count remains stable over a representative workload period. Keep the before-and-after measurements and retention decision in the service record. For wider resource problems, continue with the slow VPS diagnostic workflow; for ongoing checks, use the server operations guide.
References and further reading
Documentation reviewed on 29 November 2026. This is a documentation-based operating guide, not a report of a customer incident or a benchmark. Examples are illustrative; verify paths, permissions and installed command options in your own environment.


