Raspberry Pi No Space Left on Device¶
If a write fails with No space left on device, first find the filesystem where the application tried to write. Check free bytes with df -hT and free inodes with df -i. A filesystem can run out of places to record new files while it still has room for their contents.
1. Check the filesystem that rejected the write¶
Run these on the Pi. Replace /var with the affected file or its nearest existing parent directory. For an APT error, start with the path in the message. For a service using an external disk, use the actual data directory.
Read the mount point from TARGET and the available bytes from Avail. The inode view reports IFree and IUse%. A small tmpfs or a separate boot partition has its own limits. If you expected a USB mount and findmnt shows the root filesystem, verify the USB mount before moving or writing files. For a write inside a container, check the mount that the application sees and its backing storage on the Pi. GNU df documentation
2. Find whether bytes or inodes are exhausted¶
If Avail is nearly zero, compare directory sizes. The example below uses / because the failing path is on the root filesystem. Substitute the mount point reported by findmnt if it is elsewhere. The -x option keeps the scan on that filesystem.
If IFree is zero or nearly zero, count inodes by directory. Large numbers of small files often point to a cache, queue, or generated output directory.
Repeat the relevant command on the large directory to narrow it down. Use the application's cleanup or retention settings when they apply. For logs, check journal and application log sizes. For important files you want to move, check the destination and confirm a backup first. GNU du documentation
On a Pi 4B, a temporary filesystem with 32 inodes rejected the next file after 31 empty files and the root directory used them all. df -i showed 100% inode use while df -hT still showed 24 MiB available.
3. Check for open files that have already been deleted¶
If df still shows substantial usage after deleting a large file and du cannot see it, check for an open file with zero links. Run this if lsof is available. Use the affected mount point in place of / when needed.
Look for an entry with NLINK equal to zero and check its COMMAND, PID and NAME. A file can continue to use space until the last process holding it open closes it. For a service log, use the application's documented log-reopen action or restart the affected service when safe. Recheck df -hT on that mount afterward. lsof open-file selection, Linux unlink behavior
In the isolated Pi test, df counted an 8 MiB file held open after unlinking. du showed zero bytes for that directory, and lsof identified the open file. The 8 MiB became available when the process closed it.