Looking for Wasted HD Space on the Raspberry Pi

Twice now I’ve ran out of space on my Raspberry Pi. First time I freed up some space and the second time that happened not to long after I went looking for the problem. This is how I found it…

danger@dangerpi ~ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          3.7G  2.9G  643M  82% /
/dev/root       3.7G  2.9G  643M  82% /
devtmpfs        180M     0  180M   0% /dev
tmpfs            38M  1.3M   37M   4% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            75M     0   75M   0% /run/shm
/dev/mmcblk0p1   56M   20M   37M  35% /boot
tmpfs            75M     0   75M   0% /tmp
/dev/sda1       925G  898G   27G  98% /mnt/DangerDrive

rootfs and /dev/root are the same thing in this case, the RPis SDCard. The above is after I found the culprit and cleaned it out. Now lets drill into it a little more

danger@dangerpi / $ sudo du -sh *
5.2M    bin
19M     boot
0       dev
4.8M    etc
3.3M    home
50M     lib
16K     lost+found
4.0K    media
898G    mnt
36M     opt
du: cannot access `proc/12707/task/12707/fd/4': No such file or directory
du: cannot access `proc/12707/task/12707/fdinfo/4': No such file or directory
0       proc
28K     root
1.3M    run
5.9M    sbin
4.0K    selinux
4.0K    srv
0       sys
0       tmp
1.3G    usr
661M    var

Aha! We can see which folders take up all the space!

danger@dangerpi /var/log $ sudo du -sh *
0       alternatives.log
4.0K    alternatives.log.1
4.0K    alternatives.log.2.gz
4.0K    alternatives.log.3.gz
4.0K    alternatives.log.4.gz
173M    syslog.1
0       syslog.1.gz
940K    syslog.2.gz
904K    syslog.3.gz
4.0K    user.log.4.gz
8.0K    wtmp
220K    wtmp.1
12K     Xorg.0.log

I’ve cut this down a a little but look at that syslog file! Perty big for a log file. What was happening once I had a look at it was transmission which runs on this particular Pi was spamming errors about not being able to find some files. I deleted the logs taking up all the space with

sudo rm -f syslog.*

and then removed the offending files from transmission. Hopefully this proves to be the root of the problems.

This entry was posted in Computing, Linux, Raspberry Pi and tagged , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback.

1 Comment

  1. Posted December 24, 2015 at 11:45 am | Permalink

    ‘sudo apt-get clean’ to clear out the aptitude files that collect over time is handy too

Leave a Reply