need more space

Ryan Thompson ryan at sasknow.com
Mon Jul 14 10:02:29 PDT 2003


Kenzo wrote to freebsd-questions at freebsd.org:

> need more disk space
> This is a two part question.
> I'm running FBSD4.8
>
> 1. when I do a " df -hi " I get.
> > df -hi
> Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
> /dev/ad0s2a 126M 119M -2.6M 102% 2676 13578 16% /
> /dev/ad0s2f 252M 14K 232M 0% 8 32502 0% /tmp
> /dev/ad0s2g 21G 2.6G 17G 13% 196822 2580776 7% /usr
> /dev/ad0s2e 252M 20M 212M 8% 1144 31366 4% /var
> procfs 4.0K 4.0K 0B 100% 30 1014 3% /proc
>
> telling me that my / slice is pretty much full.
> How can I tell what is part of the / slice so that I can find what is taking
> the space and delete things that I don't need.

I do this recursively.

  cd / ; du -xd 1 | sort -n

Look at the last few lines of the output; you should see the directories
consuming the largest amount of space. If it isn't yet obvious where
you can free up space, re-run the above du(1) command on each of the
largest directories.

You've already put /tmp and /var on separate filesystems, but beware the
contents of /root (root's home directory), if you do any work as root.
You might have output logs, core files, or gawk-knows-what in root that
you've forgotten about. When / starts getting full, that's usually where
I look. :-)

> 2. would it be better to try and find what is taking all the space or
> just grow the slice with growfs?

That'd be a bad idea. Anyway, 126M root is plenty for even -CURRENT in
the standard config with /var and /tmp elsewhere... more than enough for
4.8. Find out what's consuming the space, and delete it, or (carefully)
consider moving it to another filesystem.

> Can I make the /usr slice smaller and give some to / or can I link the
> directory that's taking all the space in / to somewhere in /usr?

You can certainly do the latter, as long as you're careful of what you
move out of the root filesystem. Under normal circumstances, you don't
want to move any core OS binaries out of the root, and you definitely
don't want to move anything that's used in the bootstrap process before
the other filesystems are mounted. Root's home directory is usually fair
game, because normally even without the other filesystems mounted, you
can live without it. /tmp and /var are already separate filesystems. You
can get rid of old/GENERIC kernels and modules, as long as you keep a
boot disk around in the event that you need to change hardware in a
hurry. (I usually leave GENERIC kicking around for that reason). You can
also get rid of /stand, if you can live without sysinstall(8). You can
selectively get rid of some of the binaries in /bin and /sbin if you're
sure they won't be used either by you or the system. (grep -R <command>
/etc /boot is an imperfect but reasonable guide). If you're very clever
and know your *own* application well, you can shrink root to a fraction
of what it is now.

Now comes the part where I tell you that most of this is usually
unnecessary. :-) Chances are good that you just need to do a bit of
summer cleaning and adjust your usage habits a bit.

- Ryan

-- 
  Ryan Thompson <ryan at sasknow.com>

  SaskNow Technologies - http://www.sasknow.com
  901-1st Avenue North - Saskatoon, SK - S7K 1Y4

        Tel: 306-664-3600   Fax: 306-244-7037   Saskatoon
  Toll-Free: 877-727-5669     (877-SASKNOW)     North America



More information about the freebsd-questions mailing list