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

7

9

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

Balefire answered 18/2, 2018 at 13:49 Comment(1)
The error message which you're getting seems pretty clear to me. What are you actually asking for here?Marvelofperu
E
5

You can try this, it worked for me:

sudo apt-get autoclean
Effervesce answered 8/6, 2020 at 9:18 Comment(0)
I
2

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.

Ironist answered 19/2, 2018 at 7:50 Comment(1)
Thanks a lot for your helping, here is the log, for what i did, and what i got paste.ubuntu.com/p/pG9Gt5GSyD please check i think the issue still exist, is it ?Balefire
P
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)

Puckery answered 5/11, 2019 at 21:27 Comment(0)
M
1

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
Mcabee answered 15/1, 2021 at 9:22 Comment(0)
S
0

Try

sudo fsck.ext4 -f /dev/sda1 

(sda1 is the drive you linux is installed / is on) On a Live CD. I used gparted live(https://gparted.org/livecd.php). This will repair the file systems nodes. File system is read-only because File system is broken.

Somniloquy answered 16/8, 2022 at 20:20 Comment(0)
B
0

Without adding additional space to your partition, you can try clearing unused files that tend to pile up.

docker system prune  # removes unused docker data
sudo apt-get autoclean  # removes old downloaded archive files
# also empty your trash
Benue answered 12/3, 2024 at 18:59 Comment(0)
I
-3

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

Ironist answered 19/2, 2018 at 12:54 Comment(1)
Please credit the author of an answer when you already choose to copy it word by word: unix.stackexchange.com/a/277391Ricercar

© 2022 - 2025 — McMap. All rights reserved.