Posted on 03-03-2015 06:47 AM
Hello, thank you for taking the time to read my post. I have a bunch of MacBook Airs running Mavericks and over time the hard drives become so full they are unusable due to the /private/var/folders/ being 65GB+ in size. Currently in Casper we have a pkg that installs a LaunchDaemon and script that should remove the contents of the p/v/f but it's not working as good as I'd like it to work. One thing I've noticed lately is when I remove the p/v/f i'll watch it grow from 0KB to 8GB in a matter of 2 minutes. Once I run a script to remove all accounts on the computer it stops growing. I have attached two photos, one of the LaunchDaemon plist file and script that removes the p/v/f.
I was wondering if anyone had this same issue and could provide some insight on how you solved it. I'd really appreciate the help.
LaunchDaemon
external image link
Script
external image link
Thanks in advance.
Solved! Go to Solution.
Posted on 03-03-2015 08:30 AM
We ran into this problem on lab computers and mobile labs where there are a number of individual user logins. The /var/folders starts filling up with cached information for every user from various applications, and I wrote/adapted the script below to remove all mobile accounts (so your local admin account/other system accounts are not removed) and clean out the folder. Otherwise, as you noted before, the user accounts will start refilling the /var/folders again with information. I don't know if you're wanting user information under every one of those user accounts to be preserved, but we usually see the issues on kiosk machines where students are saving to the server/Google Drive.
You can use the find ... -exec rm -r script you listed above instead of the rm -f -R I include below to clear out cached files, but it should work the same.
#!/bin/sh
userList=`dscl . list /Users UniqueID | awk '$2 > 1000 {print $1}'`
echo "Deleting mobile accounts…"
for u in $userList ; do
dscl . delete /Users/$u && rm -rf /Users/$u
done
echo "Deleting all user cached files…"
rm -f -R /private/var/folders/*
Posted on 03-03-2015 08:30 AM
We ran into this problem on lab computers and mobile labs where there are a number of individual user logins. The /var/folders starts filling up with cached information for every user from various applications, and I wrote/adapted the script below to remove all mobile accounts (so your local admin account/other system accounts are not removed) and clean out the folder. Otherwise, as you noted before, the user accounts will start refilling the /var/folders again with information. I don't know if you're wanting user information under every one of those user accounts to be preserved, but we usually see the issues on kiosk machines where students are saving to the server/Google Drive.
You can use the find ... -exec rm -r script you listed above instead of the rm -f -R I include below to clear out cached files, but it should work the same.
#!/bin/sh
userList=`dscl . list /Users UniqueID | awk '$2 > 1000 {print $1}'`
echo "Deleting mobile accounts…"
for u in $userList ; do
dscl . delete /Users/$u && rm -rf /Users/$u
done
echo "Deleting all user cached files…"
rm -f -R /private/var/folders/*
Posted on 03-03-2015 10:14 AM
Thanks @NoahRJ . . . I will try your method out and see if it works any better. I appreciate your feedback.