Performance Issues & Calculating Home Folder size

JPDyson
Valued Contributor

When enabling Home Folder collection in the JSS (Inventory Collection Preferences), it appears to run the command du -sh /Users/username. This can cause performance issues when network shares are mounted to points within the home folder, due to the omission of the -x switch on the du command, which prevents traversal of network mounts. I would guess that -x would give us the results we actually care bout, in that it would only measure locally-stored data.

Just sharing; this is certainly what’s happening in Casper 8, but I haven’t tested it on Casper 9. To work around it, we disable the built-in home folder collection and roll our own EA:

#!/bin/bash

# Getting all users, except for known local accounts

users=(`ls /Users | egrep -v '(.localized)|(localadmin)|(so_on_and_so_forth)'`)

# Output formatting...
echo "<result>"

# Walk through the array, printing out the size of the folder in human-readable format
for i in "${users[@]}"
do
    size=`du -hsx /Users/$i 2>/dev/null`
    echo $size 
done

# Output formatting...
echo "</result>"
exit 0
0 REPLIES 0