If you do have free space on your device, it is likely that your Linux system runs out of "inodes", resulting in this error.
To debug this further and fix the issue, see the following troubleshooting and solution steps:
(1) Check available disk space to ensure that you still have some left. This can be done using the "df" command on the Linux terminal.
(2) Next, check information about available "inodes" using the command "df -i" on the Linux terminal.
If the "IUse%" value in the results is at or around 100, then a huge number of small files is the reason for the “No space left on device” errors.
(3) Find the small files using the below command on the Linux terminal or as a Shell script:
for i in /*; do echo $i; find $i |wc -l; done
This command will list directories and number of files in them. Once you see a directory with unusually high number of files (or where the command hangs over the calculation for a long time), repeat the command for that directory to see where exactly the small files are.
(4) Once you have found the suspect files, delete the files using the below command on the Linux terminal or as a Shell script:
sudo rm -rf /home/your_user/directory_with_lots_of_empty_files
(5) Check the results with the "df -i" command again on the Linux terminal to see lower usage percentages.