Wednesday, 2 November 2011

Automount differences in linux and solaris.

posting even though its been stuck in my drafts for nearly 2 years. :)
--
So im part of a project team setup to roll out linux where i work. We've had linux before but it never really worked well for us and at this stage we're running a RHEL3 build which is hopelessly out of date. We've been tasked to roll out something a bit more modern and it looks like Centos 5.x will be what we'll go for...

So we've always been a solaris house, and one of our tasks with this project is to get our Solaris and Linux environments to work together as closely as reasonably possible.

this post is about some strangeness i found with autofs in Linux vs Solaris 10..

So take this automount map snippet for example.
#auto.mymap
mymount          localhost:/path/to/mymount      serveronsamesubnet:/path/to/mymount        serveronremotesubnet:/path/to/mymount

This sort of map works as it should in a consistent way on Solaris10 / Centos5.2... First of all it parses the map sees that the localhost entry is the closest in proximity to this server ie: PROXIMITY_LOCAL (since its the same machine) and prioritizes that for mount. ie: if it is available it is the only mount that can be chosen, regardless of weightings or proximity of the other mounts.

Next we might have something like this where servers are weighted using a (number) next to the server name.
#auto.mymap
mymount          server1onsamesubnet(1):/path/to/mymount        server2onsmaesubnet(10):/path/to/mymount

This time automount will look at these weightings and use these as a scaling factor which will influence which server will be chosen to mount from.. So in this case it will determine the proximity as being PROXIMITY_SUBNET (as both servers are on the same subnet) , next it will do some RPC tests to figure out which server is most responsive [1] , this is the cost... Finally the cost is multipled by the (weight given + 1) to give a compound cost. The lowest cost server is chosen for mount.

Thus far Linux / Solaris appear to exhibit the same behaviour.

Now what happens if we havfe something like this:
#auto.mymap
mymount          localhost:/path/to/mymount        localhost:/path2/to/mymount

This might look a bit strange but it might make sense in the case where one of those localhost paths is in turn a mount to network attached storage. For example maybe on most machines you're happy for your app to scratch to NFS to a netapp which has an index of all its mounts on /netapp... But maybe on some hosts you want faster blocklevel local storage.

Well anyways in this case Linux and solaris behave differently in how they interpret the map. Owing to the way Linux (RHEL 5.3) interprets the map it will pick the first localhost mount from right-to-left, when in Solaris land it picks the first from left-to-right.

[1] - RPC tests appear to first of all try an RPC call to the remote NFS server, with a 0.1 second timeout, recording which server responds in the most timely fashion. If this fails the RPC test is repeated using a 10second timeout... Finally if this test fails automount attempts to mount the first server on the list.

No comments: