From: Greg Ercolano <erco@(email surpressed)>
Subject: [SYSADMIN/OSX]: Setting up OSX (10.3) to automount NFS on boot
   Date: Sun, 05 Dec 2004 09:01:38 -0800
Msg# 764
View Complete Thread (4 articles) | All Threads
Last Next
An easy way to get OSX machines to automatically your NFS file
server at boot time.

SETTING UP OSX TO AUTOMOUNT A REMOTE NFS SERVER
-----------------------------------------------
    There are many ways to do this, but this approach I like the best,
    because it can be done *completely* from the command line,
    which means it can be completely automated via rsh/rcp.

    In this example, we have a file server named "meade",
    which has a local disk "/net" that we export to the network.

    "meade" is a linux file server; its /etc/exports file reads:

         /net  192.168.0.0/255.255.255.0(rw,no_root_squash,insecure)

    We want to configure the OSX machine to mount meade's "/net"
    partition so that it shows up as "/meade/net" (which is similar
    to the UNC scheme the Windows machines here use to mount this drive,
    eg. //meade/net)

    Here are the steps for your OSX machine:

	0) Make sure AUTOMOUNT=-YES- is in your /etc/hostconfig.

	1) As root, create the empty directory /meade.
	   (This is the directory into which the automounter
	   will create the 'net' mount)

		mkdir -m 755 /meade

	2) Create the file /etc/auto.meade to contain:

                net     -rw,bg,intr,hard 192.168.0.14:/net
                ---     ---------------- ------------ ----
                 |              |              |        |
                 |              |              |        Partition on "meade" to mount
                 |              |              |
                 |              |              Meade's IP address. I use the IP instead,
                 |              |              so even if DNS is down, the mount will work.
                 |              |
                 |              Mount flags. Use 'hard' mounts to avoid NFS timeout errors.
                 |
                 Name that will appear in /meade, eg. "/meade/net"

	3) Test automount:

		automount -m /meade /etc/auto.meade
		ls -la /meade/net/

	   (Note trailing '/' needed in ls command)

	4) If the test works, configure the command to run on boot:

		vi /System/Library/StartupItems/NFS/NFS

	   Find the bottom of the 'StartService()' function, and add the
	   above automount command before the closing brace, eg:

		StartService()
		{
		   :
		   : default startup commands here
		   :

		   automount -m /meade /etc/auto.meade    # ADD THIS LAST
		}

		StopService()
		{
		   :

	5) Now when you reboot, you should be able to eg. 'ls -la /meade/net/'
	   to see the directory, and read/write files through the Finder.

	   Also, you should be able to go to this directory through the finder;
	   just hit SHIFT-G in a finder window, and type "/meade/net".

COMMENTS
--------
    This approach does NOT suffer from the "Zero KB available" problem with
    the finder, which can happen if you manually mount NFS partitions.

REFERENCES
----------
	http://www.hacksciences.com/hackblog-archives/000077.html
	http://sial.org/howto/osx/automount/#s4
	http://hacks.oreilly.com/pub/h/341      <-- (thanks James Wan@Universal)

Last Next