Storage monitoring tools for macOS Server
If your server runs out of storage, it can become unreliable or even fail. To prevent this, you must monitor storage usage on your servers and delete or back up files to free up space.
In the Storage pane of the Server app, you can view the usage of volumes on your server. You can also use Disk Utility to manage storage and volumes.
You can use the following macOS Server command-line tools to monitor 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 storage usage:
$ df -Hl Filesystem Size Used Avail Capacity Mounted on /dev/disk0s9 40G 38G 2.1G 95% /
In this example, the volume 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 volume lets you contact users and have them delete unused files.