Question
I have a geeky question for you.
I work in a place with a fairly large Macintosh install (270 + / -). In supporting my users, we have historically not locked them out of iTunes, iPhoto, etc. Most users do not abuse this privilege. There are, however, some that do.
One avenue that I would like to offer management is restricting the amount of space available to the users in the folders (movies, music and pictures). It would all be more manageable if the users had, say, 1 gig per folder. That way the users would still have access to the programs, but not fill their drives with music and pictures. If this was a straight Unix format, I know how I would do it. But this is HFS+, so I am not sure of the best path the achieve the desired outcome. I have some ideas of my own, but I wanted to see what wonderful, MacGeekery solution(s) you can offer.
Thank you for your help.
Answer
I don’t see any elegent and UNIXy ways to invoke folder-level quotas in OS X, but with a little elbow grease, we can get something similar. BSD Quotas are filesystem based, but are included in OS X. You could use that, but you’d have to repartition the drive, in which case you could just use the logical volume size as the limiter without needing to worry about quotas. An alternative way to accomplish the same would be to use disk images.
For example, you could create an appropriately sized disk image and store it somewhere unobtrusive. I used ~/Library/Images/. Clear out the target directory, then create an AppleScript that looks something like this and store it somewhere unobtrusive as well.
do shell script "hdiutil attach ~/Library/Images/Music.sparseimage -mountpoint ~/Music"
Add that script as a login item, and the user is now restricted to the size of the DMG’s upper limit.
There are drawbacks to this. First, disabling login items will defeat this. If your users don’t know how to do that, then you’re in the clear. The greater threat, however, is that iTunes allows users to arbitrarily store their music library anywhere they’d like. They could just tell iTunes to store their music in ~/MyMusic/ and thwart this or any other folder-based scheme.
Another possible solution would be to set up a reasonable quota system using BSD Quota, but leave quotas off, then set up a cron job that periodically totals up the filetypes you’re really targeting. If the total size exceeds a certain amount, invoke quotaon and let the system do the rest. Once the offending files are gone, quotaoff and they’re back in business.
Caveat: turning quotas on and off requires the drive be remounted, so that last part won’t be a pretty solution for shared homes or the startup disk.
How would I go about capping / monitoring bandwidth on virtual sites under OS X Server (10.4)?
Thanks.
—
SteamSHIFT
—
SteamSHIFT
Post new comment