Preventing filesystem from locking up when automount NFS share from VM goes away 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?
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.:


sudo umount /vhosts
(suspend VM)
sudo automount -vc


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