Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My problem is that I think in a couple of days there will be no space free in rootfs.

Is is possible somehow to 'clear' rootfs from unnecessary files? What should I look for?

Rootfs is mounted into md123 RAID1.

In general I have following FS division at my system:

[root@host/]# df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                2.8G  2.6G   75M  98% /
udev                  1.5G  4.0K  1.5G   1% /dev
tmpfs                 1.5G     0  1.5G   0% /dev/shm
tmpfs                 1.5G  444K  1.5G   1% /run
/dev/md123            2.8G  2.6G   75M  98% /
tmpfs                 1.5G     0  1.5G   0% /sys/fs/cgroup
tmpfs                 1.5G     0  1.5G   0% /media
/dev/md124            772M   36M  697M   5% /boot
/dev/md122            184G   61G  114G  35% /home
/dev/md126            7.4G  1.9G  5.1G  28% /var/lib/mysql
/dev/md120            1.9G  134M  1.7G   8% /tmp
/dev/md121            276G  139G  123G  53% /home2
/dev/md125             20G  8.3G   11G  46% /h1
/dev/md119            2.7T  480G  2.1T  19% /backup

output from munin

share|improve this question
up vote 1 down vote accepted

I think you have to find the files which are growing and then check if you still need them or not. Usually the first place to look at it /var/log, because all the log files are there and likely to grow.

One thing which for me is usually very useful is the du command's --max-depth parameter. because that way i can just compare all subdirectories of one directory. For example if you want to see the sizes of all subdirectories of /var/log compared with each other. You can do the following:

cd /var/log
du -h --max-depth=1

that way it sums up the size of the files in all subdirectories and lists the total for each subdirectory.

furthermore, ls -lhaS is also very useful. it lists all files of the current directory, and sorts them by size. So for example you can also check that:

cd /var/log
ls -lhaS | more

to see the biggest files inside /var/log

btw. 2.8G is quite small for a root partition. It's easy to fill that by accident if you don't monitor your services closely.

share|improve this answer
yup currently looking for 'space consumer' with du. unfortunately this would be quite problematic to change something atm. – Jevgeni Smirnov Feb 20 '13 at 6:42
You mean it would be hard to grow the size of the root partition? Well, thats often the case, unless the root partition was on something dynamic like LVM from the beginning. But growing the partition is a completely different topic. – mauro.stettler Feb 20 '13 at 6:43
yup this is very-very small server, and the partitioning was made long ago before I took it under my supervision, so this is not the only one problem with partitioning here %). Also I found out with du what in var folder most space consumers are cache, spool and log directories - 500MB. – Jevgeni Smirnov Feb 20 '13 at 6:45
Then i think you should check for each of them if you need to keep them, and otherwise remove. For example in the log folder you might not need a lot of stuff which is still there. Possibly you could prevent this issue in the future by changing the logrotate settings to keep the logfolder small. for cache and spool it depends heavily on the services you are running. – mauro.stettler Feb 20 '13 at 6:48
thanks a lot. I will think about logrotate then. – Jevgeni Smirnov Feb 20 '13 at 6:51

Start with du -x --max-depth=1 / | sort -nr to get an idea of what top-level folders in the partition are taking up the most space, then start descending though the folders until you find your space-hogs.

/var/log is a usual suspect, like mauro mentioned, but /usr and /var themselves can also be subject to some bloat. I usually create a separate /usr partition and copy/symlink /var into it.

share|improve this answer

You must log in to answer this question.

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