RE: No space left on device but free space is abailable?

I get this error message:

Traceback (most recent call last):

File "/media/user/M2/nanoGPT/data/shakespeare_char/", line 59, in <module>

train_file = tempfile.NamedTemporaryFile(delete=False, dir='/media/user/M2/nanoGPT/data/shakespeare_char/tmp')

File "/usr/lib/python3.10/", line 698, in NamedTemporaryFile

file =, mode, buffering=buffering,

File "/usr/lib/python3.10/", line 695, in opener

fd, name = _mkstemp_inner(dir, prefix, suffix, flags, output_type)

File "/usr/lib/python3.10/", line 395, in _mkstemp_inner

fd =, flags, 0o600)

OSError: [Errno 28] No space left on device: '/media/user/M2/nanoGPT/data/shakespeare_char/tmp/tmpeot_mryw'


But when I do df -h, the disk should have plenty of space available

Add Comment
1 Answers
This error message isn't necessarily related to the overall disk space. It might be caused by running out of inodes, which are data structures that represent file system objects such as files or directories. Each file system has a certain number of inodes and once you reach that limit, no new files can be created even if there is free disk space. You can check the inode usage with the command `df -i`. If the inode usage is indeed at 100%, you'll have to delete some files or increase the inode limit (which usually involves making a new file system). Also, consider if there are quota restrictions on the directory or mount point you are writing to. Even though there might be free space on the overall device, quotas might limit the amount of disk space a particular user or directory can use. This error can also occur if the location you're trying to write to is actually a mount point for a different device. Even though your main device has space, the device for the mount point might be out of space. You can check this with the command `df -h /path/you/are/trying/to/write/to`. If it shows a different device is mounted at that location, it might be that device which is out of space.
Answered on July 12, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.