Closed dinhchinh82 closed 2 years ago
You can check the space in use with:
sudo du -h /var/log/
In my case I'm using 4.5 GB with 4.1GB in /var/log/journal. So if you want to limit the size of your log journal to 100MB you can do:
sudo journalctl --vacuum-size=100M
If you installed applications and later you uninstalled them, common libraries no longer in use may be using space in your disk. You can clean that space with:
sudo apt autoremove
After modification, restart the system:
sudo reboot
In my case I'm using 4.5 GB with 4.1GB in /var/log/journal. So if you want to limit the size of your log journal to 100MB you can do:
sudo du -h /var/log/
sudo journalctl --vacuum-size=100M
sudo apt autoremove
I understand your point but as I reported above, but when I check the available space by "df -h" command, there is still 12GB flash available but still showing the "No space left on device" in the log. Sometimes this error message happens, not every time.
No hard disk space is full. This is a reminder that the system log is full and limits the size of the system log.
问下如何给/var/log扩容?目前只分配了48M,我安装了桌面服务后,启动的时候因为空间不足导致systemd-update-utmp.service没法正常启动,影响关机重启
按上面的操作
不行,断电重启后 df -h 显示 /var/log 已用还是 100%
vi /etc/fstab
temp /tmp tmpfs rw,mode=1777 0 0
vartmp /var/tmp tmpfs rw,mode=1777 0 0
varlog /var/log tmpfs rw,mode=1777 0 0
如果日志对你没什么用,你可以挂载成临时目录,每次重启自动释放掉。如果你想收集每天的日志分析,自己挂载个固定目录。
我发现 df
和 du
的结果不一样
armbian:~:# du -h --max-depth=1 /var/log
4.0K /var/log/apt
16K /var/log/lost+found
4.0K /var/log/chrony
4.0K /var/log/unattended-upgrades
4.0K /var/log/private
4.0K /var/log/openvpn
6.0M /var/log/sysstat
6.1M /var/log
armbian:~:# df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 182M 20M 162M 11% /run
/dev/mmcblk2p2 6.4G 2.5G 3.8G 40% /
tmpfs 906M 0 906M 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/zram2 889M 172K 828M 1% /var/tmp
/dev/mmcblk2p1 511M 100M 412M 20% /boot
/dev/zram1 47M 45M 0 100% /var/log
tmpfs 182M 0 182M 0% /run/user/0
然后搜到这篇文章 https://sudoedit.com/df-and-du-report-different-usage/
根据里面讲的,可以发现我这边是 syslog
导致的,于是重启该服务即可
armbian:~:# sudo lsof | grep -i deleted
bpfilter_ 297 root 2w REG 0,2 20 132 /dev/kmsg (deleted)
rsyslogd 1407 syslog 7w REG 254,1 34021376 29 /var/log/syslog (deleted)
rsyslogd 1407 syslog 8w REG 254,1 6574080 27 /var/log/kern.log (deleted)
rsyslogd 1407 1431 in:imuxso syslog 7w REG 254,1 34021376 29 /var/log/syslog (deleted)
rsyslogd 1407 1431 in:imuxso syslog 8w REG 254,1 6574080 27 /var/log/kern.log (deleted)
rsyslogd 1407 1432 in:imklog syslog 7w REG 254,1 34021376 29 /var/log/syslog (deleted)
rsyslogd 1407 1432 in:imklog syslog 8w REG 254,1 6574080 27 /var/log/kern.log (deleted)
rsyslogd 1407 1433 rs:main syslog 7w REG 254,1 34021376 29 /var/log/syslog (deleted)
rsyslogd 1407 1433 rs:main syslog 8w REG 254,1 6574080 27 /var/log/kern.log (deleted)
armbian:~:# sudo service rsyslog restart
armbian:~:# df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 182M 20M 162M 11% /run
/dev/mmcblk2p2 6.4G 2.5G 3.8G 40% /
tmpfs 906M 0 906M 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/zram2 889M 172K 828M 1% /var/tmp
/dev/mmcblk2p1 511M 100M 412M 20% /boot
/dev/zram1 47M 6.1M 38M 14% /var/log
tmpfs 182M 0 182M 0% /run/user/0
我发现
df
和du
的结果不一样 然后搜到这篇文章 https://sudoedit.com/df-and-du-report-different-usage/根据里面讲的,可以发现我这边是
syslog
导致的,于是重启该服务即可armbian:~:# sudo lsof | grep -i deleted
这是正解!
I got success to run my X96 max + [2+16G, 100M, RTL8189ftv ] on eMMC. By the way, after several hours running, there is error message on the log "No space left on device".
But when I check the available space, there are still 12GB available on /dev/mmcblk2p2