我是这个设备的新手,在没有安装太多东西之后,今天我很惊讶地看到“设备上没有剩余空间”。
df -h
Filesystem Size Used Avail Use% Mounted on
udev 216M 0 216M 0% /dev
tmpfs 49M 8.7M 40M 18% /run
/dev/mmcblk1p1 3.5G 3.3G 0 100% /
tmpfs 243M 0 243M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 243M 0 243M 0% /sys/fs/cgroup
tmpfs 49M 0 49M 0% /run/user/1000
sudo du -s -k /*
[sudo] password for debian:
4 /bbb-uEnv.txt
6664 /bin
33104 /boot
0 /dev
5988 /etc
260592 /home
4 /ID.txt
270064 /lib
16 /lost+found
4 /media
4 /mnt
4 /nfs-uEnv.txt
186408 /opt
du: cannot access '/proc/28493': No such file or directory
du: cannot access '/proc/28532': No such file or directory
du: cannot access '/proc/28533/task/28533/fd/3': No such file or directory
du: cannot access '/proc/28533/task/28533/fdinfo/3': No such file or directory
du: cannot access '/proc/28533/fd/3': No such file or directory
du: cannot access '/proc/28533/fdinfo/3': No such file or directory
du: cannot access '/proc/28554': No such file or directory
du: cannot access '/proc/28557': No such file or directory
du: cannot access '/proc/28558': No such file or directory
du: cannot access '/proc/28560': No such file or directory
0 /proc
15480 /root
8824 /run
6480 /sbin
4 /srv
0 /sys
56 /tmp
du -s -k /var/log/*
2212976 /usr
413268 /var
du -s -k /var/log/*
0 /var/log/alternatives.log
40 /var/log/alternatives.log.1
216136 /var/log/apache2
84 /var/log/apt
792 /var/log/auth.log
144 /var/log/auth.log.1
104 /var/log/bootstrap.log
0 /var/log/btmp
4 /var/log/btmp.1
4824 /var/log/daemon.log
1892 /var/log/daemon.log.1
8 /var/log/debug
28 /var/log/debug.1
0 /var/log/dpkg.log
676 /var/log/dpkg.log.1
24 /var/log/faillog
4 /var/log/fontconfig.log
204 /var/log/kern.log
948 /var/log/kern.log.1
288 /var/log/lastlog
du: cannot read directory '/var/log/lightdm': Permission denied
4 /var/log/lightdm
1244 /var/log/messages
924 /var/log/messages.1
4 /var/log/roboticscape
5772 /var/log/syslog
200 /var/log/syslog.1
20 /var/log/syslog.2.gz
56 /var/log/syslog.3.gz
4 /var/log/syslog.4.gz
376 /var/log/syslog.5.gz
1048 /var/log/user.log
24 /var/log/user.log.1
792 /var/log/wtmp
140 /var/log/wtmp.1
0 /var/log/xinput_calibrator.pointercal.log
12 /var/log/Xorg.0.log
16 /var/log/Xorg.0.log.old
通过运行sudo find / -xdev -type f -size +100M
,我发现Apache日志文件非常大:
du /var/log/apache2/access.log.1
130784 /var/log/apache2/access.log.1
如果这确实是原因,我该如何防止这种情况再次发生?我需要我的设备始终如一地工作。
答案1
为了禁用和关闭 Apache 日志记录,只需将日志条目定向 到customlog
您站点的文件中,可能在里面errorlog
/dev/null
.conf
/etc/apache2/sites-available/
或者,如果您仍想保留一些日志记录,您可以设置一个 cron 作业来定期清理日志文件。