Low Disk Space

From Mac OS X Server FAQ

Jump to: navigation, search

That’s a very subjective question!

First, evaluate how much room you had and what type of data is being stored on your server. If you’ve just picked up a group of video editors, odds are that’s where it went!

If there's no obvious reason for the extra disk space being used up, then it's quite possible that a log has gone out of control. This tends to happen very quickly when it happens, so one way to support this theory is to get an idea of the hard drive space over time. Fortunately, there is a script that runs daily which does exactly that, and the output is collected in the file /var/log/daily.out. This file may be quite long if you're server's been around for a while, so let's just look at the last 200 lines, which should get you 3 or 4 sampling intervals:

tail -n 200 /var/log/daily.out 

This should give you a good idea what the state of things were leading up to when the drive filled up.

A good technique to turn up balooned log files is to use the terminal command du –sh on the locations of the logs. The du command shows disk usage statistics and the -sh flags show entires for each specified file (s) and display the results in human speak (h).

Most log files will reside in:

~/Library/Logs
/var/log
/Library/Logs

To list the total sizes of each of three directories in one command, supply the three directory paths as arguments to the df command as follows:

root[~]du -sh /var/log /Library/Logs/ ~/Library/Logs
99M    /var/log
105M    /Library/Logs/
152K    /Users/andre/Library/Logs

If the log directories turn out to not be the culprit, try looking at /Users (remember to sudo).

To list the individual files in a directory in descending order by size, use the -S switch of ls, which we will combine with -l and -h.

ls -lSh

To tidy this up, we can show only the first 20 lines by piping into the head command; this would correspond to the 20 largest files:

ls -lSh | head -n 20

To see disk space across all volumes, use Server Admin. Select your server's name in the Computers and Services list, and click the 'system' button below. Alternatively, use df from the command line. Handy options are -h, again for 'human readable', and also -t hfs, which only lists hfs volumes (this omits devfs, fdesc, volfs, and the three automount listings).

root[~]df -h -t hfs
Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk2s6     25G   5.8G    19G    23%    /
/dev/disk5s10   112G    50G    61G    45%    /Volumes/share
/dev/disk3s3    233G   230G   3.1G    99%    /Volumes/backups
/dev/disk0s2    112G    59G    53G    52%    /Volumes/deepfreeze
/dev/disk4s10   112G    51G    61G    45%    /Volumes/archives
/dev/disk1s9     76G    69G   6.9G    91%    /Volumes/Server
/dev/disk2s7     13G   4.8G   8.3G    37%    /Volumes/Core

To be notified BEFORE a volume fills up, configure and enable diskspacemonitor. For more information, see the man page: man diskspacemonitor.

To see the size of all files & folders on a drive, many people have recommended OmniDiskSweeper or Disk Inventory X

Personal tools
Toolbox