No space left on device, df shows 89M used

Started getting this error in project “picam” – so I checked the file size and I was uploading 3.5mb jpegs, which seemed unreasonable, so I scaled them down. All is OK there.

EXCEPT why was it working before, and then just started crashing, logging:

{ Error: ENOSPC: no space left on device, write
at Error (native) errno: -28, code: 'ENOSPC', syscall: 'write' }

From console:

app@picam:/ 01:03 
$ df -h /app
Filesystem      Size  Used Avail Use% Mounted on
/dev/rbd11      128M   89M  864K 100% /app
app@picam:/ 01:03 
$ du -h -d 0 /app
79M     /app

Something doesn’t add up haha.

I thought, Is it too many dependencies? I started from scratch and I can’t reproduce.

Compare knotty-lizard to picam-remix.

Project knotty-lizard is fine, node 8.1.x and all the same dep’s as picam-remix2

Now I’ve matched the package.json in both, including the node version (8.1.x), but the picam-remix2 one complains:

Cannot find module 'multer'

while knotty-lizard (seemingly identical) seems fine, and accepts 3mb POSTs fine (for now anyway…)

Hi Lacy,

the figure df shows is misleading since we use compression to squeeze out the most from those 128MB we provide to each project. When you start reaching your quota, weird things start happening, as you can see. To get better figures, you can try to run sync so that changes are flushed to the filesystem.

As for the missing dependencies, I am not 100% sure, it might be some mistake npm is doing on their end, due to not enough space. I’ll dive into it further.

The reason why you’re running out of space is that you’re storing the image in a directory tracked by git: this means that even if you replace the image every time a new one arrives, the images are stored into the git history (we commit changes automatically every few minutes)! To free some space, you can rm -rf .git if you don’t care about your git history so far (this doesn’t affect exports nor backups), and then add a .gitignore file with the following content:

public/latest.jpg

Thanks for reporting and happy coding :slight_smile:

2 Likes

Very cool re: compression. Good to know.

And as for automatic git and large files, that makes sense. I noticed the .git folder was gigantic but when I looked at the git log it didn’t seem to have very many entries in it so I thought “maybe Glitch only kept the last ~5 commits” or something.

Is there any sort of automatic pruning of old git history?

There’s no simple user interface for the git history at present right? Maybe a feature to come? I’ve been remixing to do version control, which can be cumbersome.

Right now there’s no pruning of the git history. The idea is for it to be the history of your code, so that won’t usually take up any noticeable space.

Yes, a UI for the git history is coming. For now, you can open the console, and execute git commands there. Much better than remixing for version control :slight_smile:

1 Like