filesystems – Python causing: IOError: [Errno 28] No space left on device: ../results/32766.html on disk with lots of space
filesystems – Python causing: IOError: [Errno 28] No space left on device: ../results/32766.html on disk with lots of space
The ENOSPC
(No space left on device) error will be triggered in any situation in which the data or the metadata associated with an I/O operation cant be written down anywhere because of lack of space. This doesnt always mean disk space – it could mean physical disk space, logical space (e.g. maximum file length), space in a certain data structure or address space. For example you can get it if there isnt space in the directory table (vfat) or there arent any inodes left. It roughly means “I cant find where to write this down”.
Particularly in Python, this can happen on any write I/O operation. It can happen during f.write
, but it can also happen on open
, on f.flush
and even on f.close
. Where it happened provides a vital clue for the reason that it did – if it happened on open
there wasnt enough space to write the metadata for the entry, if it happened during f.write
, f.flush
or f.close
there wasnt enough disk space left or youve exceeded the maximum file size.
If the filesystem in the given directory is vfat
youd hit the maximum file limit at about the same time that you did. The limit is supposed to be 2^16 directory entries, but if I recall correctly some other factors can affect it (e.g. some files require more than one entry).
It would be best to avoid creating so many files in a directory. Few filesystems handle so many directory entries with ease. Unless youre certain that your filesystem deals well with many files in a directory, you can consider another strategy (e.g. create more directories).
P.S. Also do not trust the remaining disk space – some file systems reserve some space for root and others miscalculate the free space and give you a number that just isnt true.
Try to delete the temp files
rm -r /tmp/
filesystems – Python causing: IOError: [Errno 28] No space left on device: ../results/32766.html on disk with lots of space
It turns out the best solution for me here was to just reformat the drive. Once reformatted all these problems were no longer problems.