ENOSPC 设备上没有剩余空间 -Nodejs

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50142049/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:47:13  来源:igfitidea点击:

ENOSPC no space left on device -Nodejs

node.js

提问by Yinka

I just built an application with expressJs for an institution where they upload video tutorials. At first the videos were being uploaded to the same server but later I switched to Amazon. I mean only the videos are being uploaded to Amazon. Now I get this error whenever I try to upload ENOSPC no space left on device. I have cleared the tmp file to no avail.I need to say that I have searched extensively about this issue but none of d solutions seems to work for me

我刚刚使用 expressJs 为他们上传视频教程的机构构建了一个应用程序。起初视频被上传到同一台服务器,但后来我切换到亚马逊。我的意思是只有视频被上传到亚马逊。现在,每当我尝试上传 ENOSPC 时,我都会收到此错误,设备上没有剩余空间。我已经清除了 tmp 文件无济于事。我需要说我已经广泛搜索了这个问题,但似乎没有一个解决方案对我有用

采纳答案by Yinka

Well in my own case. What actually happened was while the files were been uploaded on Amazon web service, I wasn't deleting the files from the temp folder. Well every developer knows that when uploading files to a server they are initially stored in the temp folder before being copied to whichever folder you want it to(I know for Nodejs and php); So try and delete your temp folder and see. And ensure ur upload method handles clearing of your temp folder immediately after every upload

在我自己的情况下。实际发生的是当文件上传到亚马逊网络服务时,我并没有从临时文件夹中删除文件。好吧,每个开发人员都知道,将文件上传到服务器时,它们最初存储在临时文件夹中,然后再复制到您想要的任何文件夹(我知道 Nodejs 和 php);因此,尝试删除您的临时文件夹并查看。并确保您的上传方法在每次上传后立即处理清除您的临时文件夹

回答by omt66

I had the same problem, take a look at the selected answer in the Stackoverflow here:

我遇到了同样的问题,请在此处查看 Stackoverflow 中的选定答案:

Node.JS Error: ENOSPC

Node.JS 错误:ENOSPC

Here is the command that I used (my OS: LinuxMint 18.3 Sylvia which is a Ubuntu/Debian based Linux system).

这是我使用的命令(我的操作系统:LinuxMint 18.3 Sylvia,这是一个基于 Ubuntu/Debian 的 Linux 系统)。

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

回答by Hailin Tan

In my case, I got the error 'npm WARN tar ENOSPC: no space left on device' while running the nodeJS in docker, I just used below command to reclaim space.

在我的情况下,我在 docker 中运行 nodeJS 时收到错误“npm WARN tar ENOSPC:设备上没有剩余空间”,我只是使用下面的命令来回收空间。

sudo docker system prune -af

回答by Renjith

Just need to clean up the Docker system in order to tackle it. Worked for me.

只需要清理 Docker 系统即可解决它。对我来说有效。

$ docker system prune

回答by alnorth29

I got this error when my script was trying to create a new file. It may look like you've got lots of space on the disk, but if you've got millions of tiny files on the disk then you could have used up all the available inodes. Run df -hito see how many inodes are free.

当我的脚本尝试创建新文件时出现此错误。看起来您的磁盘上有很多空间,但是如果磁盘上有数百万个小文件,那么您可能已经用完了所有可用的 inode。运行df -hi以查看有多少空闲的 inode。

回答by narasimhanaidu budim

I have come across a similar situation where the disk is free but the system is not able to create new files. I am using forever for running my node app. Forever need to open a file to keep track of node process it's running.

我遇到过类似的情况,磁盘空闲但系统无法创建新文件。我永远使用它来运行我的节点应用程序。永远需要打开一个文件来跟踪它正在运行的节点进程。

If you've got free available storage space on your system but keep getting error messages such as “No space left on device”; you're likely facing issues with not having sufficient space left in your inode table.

如果您的系统上有可用的可用存储空间,但不断收到错误消息,例如“设备上没有剩余空间”;您可能会遇到 inode 表中没有足够空间的问题。

use df -iwhich gives IUser%like this

使用df -i它给出IUser%这样的

Filesystem       Inodes  IUsed    IFree IUse% Mounted on
udev             992637    537   992100    1% /dev
tmpfs            998601   1023   997578    1% /run

If your IUser%reaches 100%means your "inode table" is exhausted

如果您IUser%到达100%意味着您的“inode 表”已用尽

Identify dummy files or unnecessary files in the system and deleted them

识别系统中的虚拟文件或不必要的文件并删除它们

回答by Yinka

The issue was actually as a result of temp folder not being cleared after upload, so all the videos that have been uploaded hitherto were still in the temp folder and the memory has been exhausted. The temp folder has been cleared now and everything works fine now.

问题其实是因为temp文件夹上传后没有被清除,所以之前上传的所有视频都还在temp文件夹中,内存已经耗尽。现在临时文件夹已被清除,现在一切正常。

回答by vipinlalrv

You can set a new limit temporary with:

您可以临时设置新的限制:

sudo sysctl fs.inotify.max_user_watches=524288

sudo sysctl fs.inotify.max_user_watches=524288

sudo sysctl -p

sudo sysctl -p

If you like to make your limit permanent, use:

如果您想让您的限制永久化,请使用:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf

sudo sysctl -p

sudo sysctl -p