Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Locally Cache Mac OS X Network Login Folders OS X Server
Here at the school district, I was running into a problem where if several Mac OS X wireless clients logged into the network at once, everything slowed down to a crawl. After researching the problem, it looked like the user's Library and Microsoft User Data folders were causing the problem.

I tried turning on OS X's home folder syncronization, but that didn't work very well, and filled up our older computers fast. The solution I found was to locally cache the user's Library and Microsoft User Data folder. To do this, create a symbolic link from the user's networked 'Library' folder, and point it to a local source -- I used /tmp/UserCache/user/Library, where user is the user's short username. Here is the login script I created to automate the process:

#! /bin/bash

# Create local user caches of important directories
# Written by Steven Eppler 04/04/2006

export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin

# Set user variable
user="$1"

# This grabs the user's home directory server
input=`dscl localhost read Search/Users/$user NFSHomeDirectory`
nethomedir=${input:18}

# Or you can hardcode it...
# nethomedir="/Network/Servers/ServerName/Volume/$user"

# Check for blank nethomedir - otherwise you will delete
# the root /Library folder!
if [ """$nethomedir""" != "" ]; then

echo $user
echo $nethomedir

# Create local caching directories
mkdir /tmp/UserCache
mkdir /tmp/UserCache/$user
mkdir /tmp/UserCache/$user/Microsoft User Data
mkdir /tmp/UserCache/$user/Library

# Give everyone rights to them...
chmod -R ugo=rwx /tmp/UserCache

# Create Documents and Desktop folder (sometimes they don't exist)
mkdir $nethomedir/Documents
mkdir $nethomedir/Desktop

# Delete old folders or links
rm -rf $nethomedir/Library
rm -rf $nethomedir/Documents/Microsoft User Data

# Create new links
ln -s /tmp/UserCache/$user/Library $nethomedir/Library
ln -s /tmp/UserCache/$user/Microsoft User Data $nethomedir/Documents/Microsoft User Data

fi

Note that this comes from an entry on my blog; future code updates will likely appear there.
    •    
  • Currently 2.13 / 5
  You rated: 5 / 5 (8 votes cast)
 
[16,649 views]  

Locally Cache Mac OS X Network Login Folders | 8 comments | Create New Account
Click here to return to the 'Locally Cache Mac OS X Network Login Folders' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Locally Cache Mac OS X Network Login Folders
Authored by: CarlosD on Apr 11, '06 09:06:44AM

While you may get faster performance with this hint, you also may get some odd behavior. Library holds so much, such as mail and calendars. It may be better to restrict this hint to /Library/Caches for networked users. If I had the time, I'd use a tool like FSEventer to see what exactly is being accessed and slowing things down.

Any takers out there for R&D? :)

---

Carlos D
===
my music
http://music.altamar.dynalias.org/



[ Reply to This | # ]
Locally Cache Mac OS X Network Login Folders
Authored by: gneagle on Apr 11, '06 10:46:55AM

This doesn't _cache_ these folders - it places them on the local machine. If the local machine dies, this data is gone. Since ~/Documents/Microsoft User Data can contain your Entourage database, that would be bad. Important data is also kept in ~/Library.

Once you configure things this way, if you log into another machine, you'll find you are missing lots of stuff.

If you are only interested in network home directories as a method to make sure the ~/Documents folder gets backed up, and you are not expecting to be able to login to another machine and have a useable environment, then this might work.

I'd recommend a more conservative approach of symlinking ~/Library/Caches, which are not important to save and are faster when stored locally.



[ Reply to This | # ]
Locally Cache Mac OS X Network Login Folders
Authored by: iordonez on Apr 11, '06 10:49:56AM
I went over this one my site also, but only goes through steps for linking the Caches folder. Speed increase can be noticed on both Wireless and Wired clients. Also when linking just caches folder you don't have to worry about losing any data, system weirdness, or filling up the local HDD.

Mac OS X Server Tips and Tricks

---
Isaac Ordonez
Mac OS X Server Tips and Tricks

[ Reply to This | # ]

Locally Cache Mac OS X Network Login Folders
Authored by: eppler on Apr 17, '06 10:41:40AM

Hmm, I'll probably modify mine to do this as well and test it. I symlinked the entire folder because sometimes we have login weirdness and the only way to fix it is deleting the Library folder for that user. Where I work, the Library folder can be deleted at any time, we do not use Entourage, so we don't have to worry about data loss. Thanks.



[ Reply to This | # ]
Locally Cache Mac OS X Network Login Folders
Authored by: gneagle on Apr 11, '06 10:50:47AM

I just noticed something even worse: the folders are symlinked into /tmp, which doesn't survive restarts! So if you implement this, you _will_ destroy the user's ~/Library and ~/Documents/Microsoft User Data folder at the next restart.

Do not implement this hint unless you fully understand the implications.



[ Reply to This | # ]
Locally Cache Mac OS X Network Login Folders
Authored by: neuralstatic on Apr 11, '06 12:27:33PM

well this has created an interesting discussion at least. we've been having to ado a lot of cache symlinking to get new adobe products to work, so the topic is pretty important to us.

also what i can't figure out is how this could work with a line like

ln -s /tmp/UserCache/$user/Microsoft User Data $nethomedir/Documents/Microsoft User Data

in it since the unescaped spaces would pretty well prevent it from working.



[ Reply to This | # ]
Locally Cache Mac OS X Network Login Folders
Authored by: eppler on Apr 17, '06 10:43:07AM

It was originally escaped, the sites must have eaten the backslashes. Thanks.



[ Reply to This | # ]
Locally Cache Mac OS X Network Login Folders
Authored by: rbsandkam on Apr 12, '06 05:53:01AM

Look into Mobile Profiles available with Mac OS X Server 10.4.
There are gotchas with this as well, but it is specifically geared towards handling application performance issues with network based home directories.

b0b
--
Bob Sandkam
MacOS Support
Information Technology Specialist II
VCUarts Computer Center
School of the Arts
Virginia Commonwealth University



[ Reply to This | # ]