No space left on device

der.hans PLUGd@LuftHans.com
Wed, 21 Jun 2000 22:08:00 -0700 (MST)


Am 21. Jun, 2000 schwäzte Stuart Foster so:

> Other than the obvious, what causes this message and how do I determine how
> much space is available?

OK, we've already had posts about the two big one, e.g. df and du. We also
had Kevin's post about the kernel, which reminded us that "No space left
on device" could possibly occur due to the fs being read only (BTW, this
really pisses me off because that's not the problem, the problem is that
one is trying to write to a read only filesystem, but until I get time to
look into and be more comfortable turning in C code for the kernel it'll
stay borken) or other non-"out of space" probs :).

Here's some info on finding what's taking the space:

find / -ctime 0   # will find files changed in the last 24 hours
find / -ctime 1   # will find files changed 24 to 48 hours ago
find / -size +2000k   # will find files larger than 2MB

find seems to be pretty cool, huh? ;-)

find / -ctime 0 -size +2000k -exec ls -l {} \;   # note that the "\;" on
        # the end is required. This command finds any files modified in
        # the last 24 hours that are larger than 2MB and gives you a
        # long listing of them. Change the '-exec ls -l {}' to be
        # '-ok ">{}"' (add the double-quotes) to zero out each of the
        # files. Not the best way to clean things up, though. The -ok
        # instead of -exec means ask for each instance before doing it.

Once you've cleaned up the space, check to make sure everything's ok. If
you ran out of space in /var or whereever your log files are, you need to
HUP syslog.

kill -1 `cat /var/run/syslogd.pid`   # will work on most systems, you
        # have to 'ps aux | grep syslogd' and then 'kill -1 <the pid you
        # got from the ps>', e.g. if the pid for syslogd that you found
        # via the ps was '123', then 'kill -1 123'. After HUPping syslog
        # you should have a line in one of your log files about syslog
        # restarting.

If you have mail delivered directly to your box, you should also HUP your
mail daemon, unless it gets started by inetd.

BTW, restarting the machine will not help fix space probs. It's better to
clean up the space probs, then HUP a couple of services. After that, if
you're uncertain about the stand of things either reboot to restart
services or change to single-user mode, then back to default run level.

ciao,

der.hans
-- 
#  der.hans@LuftHans.com   home.pages.de/~lufthans/   www.Opnix.com
#  If you're not learning, you're not living. - der.hans