Disk monitoring tools

If your server runs out of disk space, it can become unreliable, or even fail. To prevent this, you must monitor disk space usage on your servers and delete or back up files to clear disk space.

In the Storage pane of the Server app, you can view the disk usage of volumes on your server. You can also use Disk Utility to manage disks and volumes.

You can use the following OS X Server command-line tools to monitor disk space on your server using Terminal. For more information about these commands, see their man pages.

df

This command tells you how much space is used and how much is available on every mounted volume.

For example, the following command lists local volumes and displays disk usage:

$ df -Hl Filesystem Size Used Avail Capacity Mounted on /dev/disk0s9 40G 38G 2.1G 95% /

In this example, the hard disk is almost full with only 2.1 GB left, which means you should act immediately to free space.

du

This command tells you how much space is used by specific folders or files.

For example, the following command tells you how much space is used by each user’s home folder:

$ sudo du -sh /Users/* 3.2M /Users/Shared 9.3M /Users/omar 8.8M /Users/jay 1.6M /Users/lili

Knowing who’s using most of the space on the hard disk lets you contact users and have them delete unused files.