"No space left on device" error when there should be space

April 24, 2016 842 views
Linux Basics Linux Commands

I have a droplet that has been collecting some data for me, I now want to run a python script, which fails as follows:

out = open('data.tsv', 'w')
IOError: [Errno 28] No space left on device: '/data.tsv'

The problem is, I think there should be plenty of space. Running df -h produces the following:

Filesystem                 Size  Used Avail Use% Mounted on
udev                       235M  4.0K  235M   1% /dev
tmpfs                       50M  344K   49M   1% /run
/dev/disk/by-label/DOROOT   20G  6.8G   12G  37% /
none                       4.0K     0  4.0K   0% /sys/fs/cgroup
none                       5.0M     0  5.0M   0% /run/lock
none                       246M     0  246M   0% /run/shm
none                       100M     0  100M   0% /run/user
1 comment
2 Answers

I'm not great when it comes to coding but here's a couple of things to check until a programmer comes along.

Sounds like a permissions issue.
1 ) Does the file you are trying to write to exist?
2) Are you going to run the script manually each time?

Sounds like if the file exists and you are manually running the script, you don't have the correct privileges to write to the file.

Actually, I believe this may be an issue of you telling it to delete files, but the system hasn't actually done so, but the pointers are gone.

Run this:

lsof|grep delete

If you see a lot of things return, the simplest solution would be to reboot. It will clear up those files when it restarts.

Have another answer? Share your knowledge.