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

Article directory

origin

As usual, I typed cd in the linux terminal, then clicked tab and hoped that the system would automatically complete the code for me, but this error was reported.

After some analysis, I found that my disk space was full.

position

输入:df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/dm-0       7.8G  5.2G  2.6G  67% /
udev             10M     0   10M   0% /dev
tmpfs           3.2G  345M  2.9G  11% /run
tmpfs           7.9G  2.4M  7.9G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           7.9G     0  7.9G   0% /sys/fs/cgroup
/dev/vdc1       100G   59G   42G  59% /home
/dev/vda1       236M   33M  191M  15% /boot

Here:
/dev/dm-0 7.8G 5.2G 2.6G 67% /
Now it shows 67%, it was 100% when the error was reported before

So switch to: cd /

Switch to administrator: su root

Then type:
du -lh --max-depth=1

31M     ./boot
3.4M    ./etc
0       ./media
2.1G    ./var
1.2G    ./usr
204M    ./lib
0       ./lib64
8.9M    ./bin
7.5M    ./sbin

It can be seen that the space occupied by ./var is relatively large

So cd to this directory and continue typing

du -lh --max-depth=1

solve

I finally located two log files, which took up a lot of space. After confirming that the deletion would not bring any adverse effects, I directly rmed them out.

restart syslog

If Ubuntu
deletes syslog, it is best to restart it

service rsyslog restart

Alternatively, this
systemctl restart rsyslog

Guess you like

Origin blog.csdn.net/qq_37768971/article/details/114021205