简体   繁体   English

无法为此处文档创建临时文件:设备上没有剩余空间

[英]cannot create temp file for here-document: No space left on device

i have a digital ocean Ubuntu server, two days ago every page in my website gives me error 500,我有一个数字海洋 Ubuntu 服务器,两天前我网站的每个页面都给我错误 500,

in ssh i got this error message "No space left on device",在 ssh 中,我收到此错误消息“设备上没有剩余空间”,

For more info please check this SSH screenshot有关更多信息,请查看此 SSH 屏幕截图

so i restore backup and the server and website works fine now, but it will happen again in near future所以我恢复备份,服务器和网站现在工作正常,但不久的将来会再次发生

and this is the current server status这是当前的服务器状态

root@****:~# df -k
Filesystem     1K-blocks     Used Available Use% Mounted on
udev             4077544        4   4077540   1% /dev
tmpfs             817680      340    817340   1% /run
/dev/vda1       82436784 34630128  43596088  45% /
none                   4        0         4   0% /sys/fs/cgroup
none                5120        0      5120   0% /run/lock
none             4088392        0   4088392   0% /run/shm
none              102400        0    102400   0% /run/user
root@****:~# df -i
Filesystem      Inodes   IUsed   IFree IUse% Mounted on
udev           1019386     402 1018984    1% /dev
tmpfs          1022098     319 1021779    1% /run
/dev/vda1      5242880 5014058  228822   96% /
none           1022098       2 1022096    1% /sys/fs/cgroup
none           1022098       5 1022093    1% /run/lock
none           1022098       1 1022097    1% /run/shm
none           1022098       2 1022096    1% /run/user
root@****:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G  4.0K  3.9G   1% /dev
tmpfs           799M  340K  799M   1% /run
/dev/vda1        79G   34G   42G  45% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            3.9G     0  3.9G   0% /run/shm
none            100M     0  100M   0% /run/user
root@****:~# ls /tmp/
root@****:~# fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/vda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/vda: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders, total 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1               1   167772159    83886079+  ee  GPT

Thanks in advance提前致谢

你可以试试这个,它对我有用:

sudo apt-get autoclean

Please try to use commands to resolve your issue:请尝试使用命令来解决您的问题:

root@****:~# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT名称 MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 150G 0 disk xvda 202:0 0 150G 0 磁盘
└─xvda1 202:1 0 8G 0 part / └─xvda1 202:1 0 8G 0 部分 /

root@****:~# df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      7.8G  4.5G  2.9G  61% /
tmpfs            32G     0   32G   0% /dev/shm

Looking at above thing it seems that EBS is having 150 GB but the root partition is only 8 GB.从上面看,EBS 似乎有 150 GB,但根分区只有 8 GB。

So to resize EBS Root Volume所以要调整 EBS 根卷的大小

root@****:~# sudo growpart /dev/xvda 1

To install "growpart" use安装“growpart”使用

root@****:~# sudo yum install -y cloud-init dracut-modules-growroot

And restart the engine.并重新启动发动机。

I just encountered a similar issue.我刚刚遇到了类似的问题。

Solved in two commands without a reboot:无需重启即可通过两个命令解决:

It was due to the LV created by default on ubuntu installation.这是由于在 ubuntu 安装中默认创建了 LV。 1. Find the LV name with lvdisplay. 1、用lvdisplay查找LV名称。 2. lvextend -rL +1G LVNAME (or instead of "-r" you can resizefs as the next command) 2. lvextend -rL +1G LVNAME(或者代替“-r”你可以resizefs作为下一个命令)

The answer given above by ECB worked for me but it required LV Path insted of LV Name in the second part of the answer. ECB上面给出的答案对我有用,但它需要在答案的第二部分 LV 路径插入 LV 名称。

An alternative suggested by a colleague will resize to use 100% of the disk.同事建议的替代方法是调整大小以使用 100% 的磁盘。

sudo lvm
lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
exit

sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

Try尝试

sudo fsck.ext4 -f /dev/sda1 

(sda1 is the drive you linux is installed / is on) On a Live CD. (sda1 是您安装/打开 linux 的驱动器)在 Live CD 上。 I used gparted live( https://gparted.org/livecd.php ).我使用了 gparted live( https://gparted.org/livecd.php )。 This will repair the file systems nodes.这将修复文件系统节点。 File system is read-only because File system is broken.文件系统是只读的,因为文件系统已损坏。

Your root file system is full and hence your temp dir (/tmp, and /var/tmp for that matter) are also full.您的根文件系统已满,因此您的临时目录(/tmp 和 /var/tmp)也已满。 A lot of scripts and programs require some space for working files, even lock files.许多脚本和程序需要一些空间来存放工作文件,甚至锁定文件。 When /tmp is unwriteable bad things happen.当 /tmp 不可写时,坏事就会发生。

You need to work out how you've filled the filesystem up.你需要弄清楚你是如何填满文件系统的。 Typically places this will happen is in /var/log (check that you're cycling the log files).通常会发生这种情况的地方是 /var/log (检查您是否正在循环日志文件)。 Or /tmp may be full.或者 /tmp 可能已满。 There are many, many other ways that a disk can fill up, however.但是,还有很多其他方法可以填满磁盘。

du -hs /tmp /var/log du -hs /tmp /var/log

You may wish to re-partition to give /tmp it's own partition (that's the old school way of doing it, but if you have plenty of disk it's fine), or map it into memory (which will make it very fast but start to cause swapping issues if you overdo the temporary files).您可能希望重新分区以给 /tmp 它自己的分区(这是老派的做法,但如果您有足够的磁盘就可以了),或将其映射到内存中(这将使其非常快但开始如果您过度使用临时文件,则会导致交换问题)。

Or try unmounting the overflow partition:或者尝试卸载溢出分区:

umount /tmp卸载/tmp

OR

umount overflow卸载溢出

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM