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

3

i have a digital ocean Ubuntu server, two days ago every page in my website gives me error 500,

in ssh i got this error message "No space left on device",

For more info please check this SSH screenshot

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

ubuntu
cloud
partitioning
digital-ocean
asked on Stack Overflow Feb 18, 2018 by Fathi • edited Feb 19, 2018 by Kenster

5 Answers

2

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. 1. Find the LV name with lvdisplay. 2. lvextend -rL +1G LVNAME (or instead of "-r" you can resizefs as the next command)

answered on Stack Overflow Nov 5, 2019 by ECB
1

Please try to use commands to resolve your issue:

root@****:~# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 150G 0 disk
└─xvda1 202:1 0 8G 0 part /

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.

So to resize EBS Root Volume

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

To install "growpart" use

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

And restart the engine.

answered on Stack Overflow Feb 19, 2018 by Mahendra Andhale • edited Feb 20, 2018 by Rao
1

You can try this, it worked for me:

sudo apt-get autoclean
answered on Stack Overflow Jun 8, 2020 by DARK_C0D3R
0

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.

An alternative suggested by a colleague will resize to use 100% of the disk.

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

sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
answered on Stack Overflow Jan 15, 2021 by Matthew Thornington • edited Jan 15, 2021 by Matthew Thornington
-2

Your root file system is full and hence your temp dir (/tmp, and /var/tmp for that matter) are also full. A lot of scripts and programs require some space for working files, even lock files. When /tmp is unwriteable bad things happen.

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). Or /tmp may be full. There are many, many other ways that a disk can fill up, however.

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).

Or try unmounting the overflow partition:

umount /tmp

OR

umount overflow

answered on Stack Overflow Feb 19, 2018 by Mahendra Andhale

User contributions licensed under CC BY-SA 3.0