Ok. So. I have a gentoo vm that I share files with through to my host os, osx (i know, please help me). Since I didn’t really seem to see any sort of fstab variant for osx, i found out that auto mounter is available and quite awesome for ensuring that things stay mounted whether it be at boot, during a network outtage, or whatever.

So let me outline a very simple way to do this with links with more detail below:

1) /etc/automaster is the file that contains each and every automount that you want it to take care of. Think of it as /etc/exports but not exactly. You see young padawan, automaster points to another file which describes the specifics for the mount including the location etc..

So for instance, here is my auto_master file for this new mount I want to do of /home/name (server) to /home/name (client):

/- auto_resources

2) The “/-” above says that the actual location to mount to is located in the “/etc/auto_resources”…which contains the following:

/home/name -fstype=nfs,rw genx:/home/name

3) Now restart the automounter for it to read the new configuration:

sudo automount -vc

4) Now, that share should always be mounted there as long as the remote nfs server is available. Note that the share is actually mounted when you go to enter the directory, not something that really alters the way you will use it, just something to be aware of. An example of this is shown below:

Before entering the dir:

Screen Shot 2013 07 08 at 6 05 28 PM

After entering the dir:

Screen Shot 2013 07 08 at 6 05 50 PM

As you can see, /home/mloria is actually mounted after I enter the dir, but its definitely loaded in the mapper as something to mount before i actually enter.

LINKS!!! #1, #2

On to perms…

The point if this for me was to have full perms between the nfs share and my local user. I didn’t want any restrictions on creating or editing files across the host and guest operating systems. So I obviously exported the share rw,insecure,norootsquash and mounted it rw (just to be sure). However, with automounter, it by default seemed to mount the directory with only root being allowed full access. To fix this, all I did was make sure the nfs share was mounted, and chown’ed the dir it was mounted to (in this case, /home/mloria) to the user that I wanted to have full access, “mloria”. That seemed to work just fine and seems to be holding after an unmount/remount.

Blog Logo

Mario Loria


Published

Image

./scriptthe.net

Because 127.0.0.1 gets old after a while.

Back to Overview