Dealing with Full Disks
Pages: 1, 2
Now let's look at the main /usr and /var directories to see if anything unusually large is lurking there.
#cd /usr
#du -h -d1
11M ./bin
7.5M ./include
34M ./lib
9.6M ./libdata
15M ./libexec
571M ./local
6.3M ./sbin
39M ./share
289M ./src
119M ./ports
57M ./compat
1.5M ./games
323M ./obj
1.0K ./tmp
234M ./X11R6
1004M ./home
11M ./sup
36M ./doc
2.7G .
#
This output is pretty normal. There's 323 MB of stuff in /usr/obj
that I can blow away easily enough, to gain another third of a GB.
Just for reference, I'm attaching the output of a fairly empty /var
filesystem. Depending on the purpose of your system, different /var
directories can grow considerably. There's a surprisingly small
amount of stuff in /var, however.
# du -h -d1
1.0K ./account
3.0K ./at
8.0K ./backups
2.0K ./crash
2.0K ./cron
4.3M ./db
434K ./log
7.3M ./mail
2.0K ./msgs
1.0K ./preserve
54K ./run
1.0K ./rwho
18K ./spool
10.0K ./tmp
20K ./yp
62K ./games
2.0K ./lib
4.0K ./ucd-snmp
1.0K ./heimdal
12M .
#
The next time you find /var filling up, you can compare your directory structure to what you have here and at least have a good idea of what
is normal on a small system.
du(1) to browse through the entire filesystem and see
where the main bloat is. The biggest cause of bloat in the rest of
the system is installed software and user data. In the example above,
/usr/local consumes over half a gigabyte. Deleting user data is not
usually a good idea, but you can track down large packages easily
enough with the -s flag to pkg_info(1).
# cd /var/db/pkg
# pkg_info -s *
Information for Hermes-1.3.2:
Package Size:
449 (1K-blocks)
Information for Mesa-3.4.1:
Package Size:
2507 (1K-blocks)
...
This can create huge amounts of output if your system has many packages installed. For example, my laptop has 134 of them. Scan through this looking for large packages.
Information for emacs-20.7:
Package Size:
43800 (1K-blocks)
Emacs is 43 MB? Yeah, yeah, I know, use vi.
|
Related Reading
|
While many of the ports are necessary, I find quite a few that aren't
vital or that I can easily reinstall. For example, there's 100 MB of teTex as a dependency on /usr/ports/textproc/docproj. That's
simple enough to replace from a recent FreeBSD release -- teTex does
not change quickly enough to require the freshest possible build.
By removing teTex and /usr/obj, I get enough space to copy this huge file to my laptop. du and pkg_info gave me the necessary information to safely choose the files to delete -- without having to mess with the user data in $HOME/mp3. Data is what's important, after all.
Read more Big Scary Daemons columns.
Return to the BSD DevCenter.
