0

I do a lot of web applications development, and I run a Fedora VM on my Mac to simulate the server environment. Meanwhile, I run the IDE on the Mac side, and it requires a local filesystem to make changes. Hm.

I solved this problem by exporting my code directories in Fedora via NFS and using automount on the Mac side to automatically mount the shares as needed:

# fedora:/etc/exports
/var/vhosts/ 192.168.182.1(rw,insecure,all_squash,anonuid=1000,anongid=1000)

# mac:/etc/auto_master
...
/vhosts auto_vhosts

# mac:/etc/auto_vhosts
* fedora:/var/vhosts/&

I love this setup because it Just Works and is maintenance-free... so long as my VM is running.

If I suspend or shut down my VM, however, everything goes crazy. Any filesystem-related operations take forever (even seemingly-unrelated actions like launching iTunes or shutting down my system), and the Console fills up with lots of messages from KernelEventAgent about the mount not responding.

The issue persists until I restore my VM state.

One way to work around this issue is to always leave my VM running, but that sucks up a ton of RAM, and I'd prefer to be able to suspend my VM for e.g., games or other resource-intensive apps that I might want to run.

Is there a way I can keep my existing automount setup, but still have the flexibility to suspend my VM and have my Mac stop blocking filesystem operations waiting for the NFS connection to timeout?

1

I've found that umount-ing the share will also resolve the problem each time I suspend my VM.

It's not a perfect solution, as it has to be done manually, but it does work.

E.g.:

  1. sudo umount /vhosts
  2. (suspend VM)
  3. sudo automount -vc

I haven't tested whether step 3 is necessary, but I figure it couldn't hurt.

0

You should add "intr" to your mount options. See the mount_nfs man page for details:

man mount_nfs
...
intr    Make the mount interruptible, which implies that file system calls that 
        are delayed due to an unresponsive server will fail with EINTR when a
        termination signal is posted for the process.
  • Adding the intr flag didn't seem to help, but I looked at some of the other options, and adding the bg flag did speed things up a little bit. If only there were a way to set the maximum connection timeout, I'd be set... but I didn't see an option for that. – user5118 Apr 30 '13 at 21:58

You must log in to answer this question.