Errno 28 设备上没有剩余空间,尽管还有空间

Errno 28 设备上没有剩余空间,尽管还有空间

你好,我对 ubuntu 还很陌生,今天当我尝试打开 jupyter notebook 时出现了以下错误:

myname@My-Laptop:~$ jupyter notebook
[I 2022-08-08 07:58:41.188 LabApp] JupyterLab extension loaded from /home/myname/.local/lib/python3.8/site-packages/jupyterlab
[I 2022-08-08 07:58:41.188 LabApp] JupyterLab application directory is /home/myname/.local/share/jupyter/lab
[I 07:58:41.192 NotebookApp] Serving notebooks from local directory: /home/myname
[I 07:58:41.192 NotebookApp] Jupyter Notebook 6.4.12 is running at:
[I 07:58:41.192 NotebookApp] http://localhost:8888/?token=da2f7fe6c8a740552fa218fb35dc25f82a4ca50d30a39605
[I 07:58:41.192 NotebookApp]  or http://127.0.0.1:8888/?token=da2f7fe6c8a740552fa218fb35dc25f82a4ca50d30a39605
[I 07:58:41.192 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[E 07:58:41.192 NotebookApp] Failed to write server-info to /home/aswirbul/.local/share/jupyter/runtime/nbserver-71.json: [Errno 28] No space left on device
OSError: [Errno 28] No space left on device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/myname/.local/bin/jupyter-notebook", line 8, in <module>
    sys.exit(main())
  File "/home/myname/.local/lib/python3.8/site-packages/jupyter_core/application.py", line 269, in launch_instance
    return super().launch_instance(argv=argv, **kwargs)
  File "/home/myname/.local/lib/python3.8/site-packages/traitlets/config/application.py", line 976, in launch_instance
    app.start()
  File "/home/myname/.local/lib/python3.8/site-packages/notebook/notebookapp.py", line 2336, in start
    self.write_browser_open_file()
  File "/home/myname/.local/lib/python3.8/site-packages/notebook/notebookapp.py", line 2240, in write_browser_open_file
    self._write_browser_open_file(open_url, f)
OSError: [Errno 28] No space left on device

我很困惑为什么会出现此错误,因为我的笔记本电脑有足够的存储空间。我使用df -h并得到以下结果:

myname@My-Laptop:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb        251G  239G     0 100% /
tmpfs           3.1G     0  3.1G   0% /mnt/wsl
tools           476G  421G   56G  89% /init
none            3.1G     0  3.1G   0% /dev
none            3.1G  4.0K  3.1G   1% /run
none            3.1G     0  3.1G   0% /run/lock
none            3.1G     0  3.1G   0% /run/shm
none            3.1G     0  3.1G   0% /run/user
tmpfs           3.1G     0  3.1G   0% /sys/fs/cgroup
drivers         476G  421G   56G  89% /usr/lib/wsl/drivers
lib             476G  421G   56G  89% /usr/lib/wsl/lib
C:\             476G  421G   56G  89% /mnt/c

我怎样才能清理一些空间(不删除重要文件)以便再次打开 jupyter 笔记本?

答案1

问题不在于您的机器上是否有空间,而在于您尝试写入的特定位置是否有空间。在这种情况下,您的df输出非常清楚:您的根分区已 100% 满。这就是第一行告诉您的内容:

myname@My-Laptop:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb        251G  239G     0 100% /

并且错误会准确地告诉您 Jupyter Notebook 试图写入的位置:

[E 07:58:41.192 NotebookApp] Failed to write server-info to /home/aswirbul/.local/share/jupyter/runtime/nbserver-71.json: [Errno 28] No space left on device

该文件/home/aswirbul/.local/share/jupyter/runtime/nbserver-71.json位于/home/aswirbul/.local/share/jupyter/runtime/的子目录中/,并且该分区上没有剩余空间。由于您尝试写入,因此输出/中的其他行均不df相关。是的,您的 Windows 驱动器上有空间,但这不是您要写入的位置,因此它没有帮助。

您需要删除一些文件。我们无法告诉您删除了哪些文件,因为我们无法访问您的计算机,也不知道哪些文件是“重要”文件,但 251G 是很多Linux 系统的空间有限,所以你可能有各种各样的东西闲置着。看看这里的解决方案:没有更多磁盘空间:如何找到占用空间的内容?

答案2

当您尝试将太多文件写入目录时,您可能会收到此错误,请参阅我的回答:https://stackoverflow.com/questions/6998083/python-causing-ioerror-errno-28-no-space-left-on-device-results-32766-h/78195484#78195484即使您的文件系统有足够的空间来表示所使用的文件名,也会有最大目录大小限制。

相关内容