Display SSD usage / % full

ImAMacGuy
Valued Contributor II

I've been tasked wtih trying to rightsize our Mac fleet's SSD that we purchase for the devices.  I've been tried doing an EA script that is generating some info and I tried creating an advanced computer search looking at "Boot Volume % full".  The Comp search one seems to give inconsistent data when I click into a machine record it vary's wildly from the column the report spits out.  

 

I was thinking that once I get consistent data out, I could use smart groups to dump the machines that are 25% full go into one group, 26-50% to another, and so on.  But I'm also open to other suggestions.

 

thank you!

6 REPLIES 6

sdagley
Esteemed Contributor III

@ImAMacGuy If you're trying to do this purely via Smart Group criteria then the Boot Drive Percentage Full is probably your best bet. If you're open to using the Jamf Pro API then you can look at the storage data for a device to determine what percentage of the Data partition is in use (to be clear the API returns all of the partitions on the disk, I just edited it down to the Data one which is where user files live):

  "storage": {
    "bootDriveAvailableSpaceMegabytes": nnnnnnn,
    "disks": [
      {
        "id": "nnnnnnnnn",
        "device": "disk0",
        "model": "APPLE SSD AP1024Z",
        "revision": "2077.100",
        "serialNumber": "nnnnnnnnn",
        "sizeMegabytes": nnnnnnnnn,
        "smartStatus": "Verified",
        "type": "NO",
        "partitions": [
          {
            "name": "Data",
            "sizeMegabytes": 994662,
            "availableMegabytes": 682966,
            "partitionType": "OTHER",
            "percentUsed": 30,
            "fileVault2State": "ENCRYPTED",
            "fileVault2ProgressPercent": 100,
            "lvmManaged": false
          }
        ]
      }
    ]
  },

 

matgr
New Contributor

you would think it would be easy to get what you see in Finder > Get Info like this via Terminal but its not due to Containers, volumes and security what I've determined is
Finder shows everything, your files, system files, hidden backups (snapshots), and purgeable space.
Terminal tools like df or diskutil only see parts of the disk — mostly your files, not hidden system stuff.
macOS uses APFS volumes and snapshots, which Terminal can’t fully see due to security (SIP) and how disks are structured, which why a script shows less used space than Finder — the “missing” GB is hidden but still there.

 


Screenshot 2025-05-01 at 16.00.43.png

ImAMacGuy
Valued Contributor II

The one-off identification is one thing, but I'm trying to see in a more wholistic way the fleet's storage in use vs storage available.  I want to be able to see across the fleet, with the ultimate goal of for example, if 80% of the users are using less than 500gb, then we can save some money on hardware by getting 512g drives rather than 1TB+.  

matgr
New Contributor

I guess thats going to be an API pull into a DB and some data crunching

matgr
New Contributor

@ImAMacGuy or you could use a Digital Employee Experience (DEX) tool to pull lots of info that could then be crunched. Will be ££'s though

https://nexthink.com/solutions/measure-and-improve-dex
https://www.controlup.com/resources/blog/what-is-digital-employee-experience-dex-everything-it-leade...





ScottEKendall
Contributor

this is an EA that I use in my company

#!/bin/sh
#https://www.jamf.com/jamf-nation/discussions/12546/boot-volume-free-space-ea

DU=$(df -h /Users | awk 'END{ print $(NF-4) }' | tr -d '%' )

# print the reuslts padding with leading 0

echo "<result>$(printf "%02d\n" $DU)</result>"

and then I use that EA to create a smart group along with nice GUI to display to the users about their disk space: https://github.com/ScottEKendall/JAMF-Pro-Scripts/tree/main/LowDiskSpace