3

I have a 5-yr old Ubuntu laptop. It's running 12.04 LTS, and has never given me much if any trouble. Last night while updating, a disk analyzer popped up, and said I had very little space left. It was correct.

Since then, I've been manually cleaning up old kernels and their related files under /boot. I'm down from 95% to 89%. I've looked under /var/spool and cleaned up many, but not very large spool files that never printed from a long time ago. The disk analyzer just points to root at 100%, showing /usr at 45% and a trickle for everything else including /home.

I checked with Synaptic. I don't have big packages installed like apache or mysql. What else could be filling up the disk and how should I approach the clean-up other than a brute force install?

I am using this script

#!/bin/bash

ORPHANS=`deborphan`
if [ ! -z "$ORPHANS" ]; then
    dpkg --remove $ORPHANS
fi

PURGES=`dpkg --list | grep ^rc | awk '{ print $2; }'`
if [ ! -z "$PURGES" ]; then
    dpkg --purge $PURGES
fi

that I found here.

However, this has only taken root down to 88%, and adding deborphan added 1%, when I had to install it.

1
  • What is df command's displaying free space?
    – Pandya
    Jun 14, 2014 at 12:41

2 Answers 2

2

The most likely place to look into is /var/log/. I remember a time when logrotate was not configured to handle all relevant log files.

Start with du -sh /var/log/* to see if there is a "huge" directory there.

1

If you have multiple partitions, first don't bother cleaning non full partitions. Focus on the one that is full.

You can df -h /some/dir to check if the partition containing /some/dir is full or not (of course there could be yet another partition mounted underneath.. if so, take it into consideration)

You can also look for the biggest dirs by sorting each dirextory's size : as root, do a df -kS / | sort -n and be patient... (as sort needs the whole output before sorting, you will see everything once the du finishes) (du -kS differ from du -ks : it doesn't count subdirs, so it helps pinpoint the exact dir containing the bigger files. Works with gnu du, at least.)

Another way : as root, find -type f -size +100000 -ls | sort -k7,7n to find the biggest files by only outputting the biggest (more than 512x100000=51Mb) (as the size arg is in 512 bytes (the default block size)). The number 7 in sort is to sort on the 7th field. Adjust if the size is in another field (I do this from memory, I'm travelling...) (-k7,7n tells sort to sort numerically "from the 7th to the 7th field" as othrrwise sort sort fields 7th to the last, which could usually not be what you want...)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .