Piaware out of free space...I suspect large log files...

I’ve been getting errors from my piaware that it is out of space. For example, I tried writing to


~/.ssh/authorized_keys

, but got a disk full error. I did a


sudo apt-get clean

and that helped, but what else could be wrong?

My log files look like this:



pi@piaware ~ $ ls -laS /var/log
total 901320
-rw-r-----  1 root adm  307365928 Jul 18 16:17 syslog
-rw-r-----  1 root adm  307310115 Jul 18 03:26 kern.log
-rw-r-----  1 root adm  307278931 Jul 10 01:39 debug
-rw-r--r--  1 root root    328694 May  6  2015 bootstrap.log
-rw-rw-r--  1 root utmp    292292 Jul 18 16:38 lastlog
-rw-r-----  1 root adm      79107 Jul 18 16:38 auth.log
-rw-r--r--  1 root root     49683 Aug 15  2015 dpkg.log.6.gz
-rw-r-----  1 root adm      39662 Jul 18 03:26 messages
-rw-r-----  1 root adm      33413 Apr 17 06:25 auth.log.1
-rw-rw-r--  1 root utmp     29568 Jul 10 06:13 wtmp.1
-rw-r--r--  1 root root     27789 Jul 10 01:39 dpkg.log.1
-rw-r--r--  1 root root     24024 May  6  2015 faillog
...

df reveals this:


pi@piaware ~ $ df -ah
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       2.9G  2.7G   31M  99% /
devtmpfs        459M     0  459M   0% /dev
tmpfs            93M  236K   93M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
proc               0     0     0    - /proc
sysfs              0     0     0    - /sys
tmpfs            47M     0   47M   0% /run/shm
devpts             0     0     0    - /dev/pts
/dev/mmcblk0p1   56M   20M   37M  36% /boot
tmpfs            47M  132K   47M   1% /tmp

Do these file sizes look right? Where else might I look?

Thanks,
Brian

You may need to delete the larger log files to free up some space.
It looks like log file rotation is not working or enabled.

This is what an RPI3 with a 16GB card looks like
df -ah
Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 2.9G 12G 21% /
devtmpfs 459M 0 459M 0% /dev
sysfs 0 0 0 - /sys
proc 0 0 0 - /proc
tmpfs 463M 0 463M 0% /dev/shm
devpts 0 0 0 - /dev/pts
tmpfs 463M 16M 448M 4% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
cgroup 0 0 0 - /sys/fs/cgroup/systemd
cgroup 0 0 0 - /sys/fs/cgroup/cpu,cpuacct
cgroup 0 0 0 - /sys/fs/cgroup/blkio
cgroup 0 0 0 - /sys/fs/cgroup/memory
cgroup 0 0 0 - /sys/fs/cgroup/devices
cgroup 0 0 0 - /sys/fs/cgroup/freezer
cgroup 0 0 0 - /sys/fs/cgroup/net_cls
systemd-1 - - - - /proc/sys/fs/binfmt_misc
mqueue 0 0 0 - /dev/mqueue
debugfs 0 0 0 - /sys/kernel/debug
configfs 0 0 0 - /sys/kernel/config
/dev/mmcblk0p1 60M 21M 40M 35% /boot
binfmt_misc 0 0 0 - /proc/sys/fs/binfmt_misc

How large is the flash card?

run sudo raspi-config to expand the partitions
Select 1
1 Expand Filesystem Ensures that all of the SD card s
exit and restart

or
sudo raspi-config --expand-rootfs

then reboot.

The top 3 are abnormally large. Take a look at the contents to work out what is filling them up.

Looks like /dev/root is pretty small. Either you have a small card, or it’s not formatted/partitioned properly. See raspberrypi.org/forums/view … 51&t=45265 which seems to possibly address your issue.

yes to both cited concerns:
(1) log files are too damn big – why?
(2) file system probably wasn’t expanded to fill the device. This needs to be done the first time you boot a new system

A tool I use to figure out where space is being used:


alias diskuse='sudo du -a --exclude=/proc / | sort -k 1 -g -r | head -n 200 > ~/$HOSTNAME.diskuse.txt'

execute this (even better, copy it to your .bash_aliases file so it gets done on login), and then type in:

diskuse

at the command line. When I run this on my R Pi named weasels, I get a file: weasels.diskuse.txt created in my home directory (that’s the ~/ part), which lists the top 200 directories on the disk in terms of size.

Now I can figure out where the space is being tied up, and prune things back.

Another hint, for those of you that are ok starting with a bare system: Use the Jessie Lite distro. It doesn’t include a lot of things such as Wolfram, the desktop, and a lot of other stuff.

–bob k6rtm