Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Clear out phantom NFS shares Network
This is a hint about phantom NFS shares that may linger on your system long after you stopped accessing the share, and that may cause slowdowns and errors with various disk utilities. The information here applies to Lion, and may differ in earlier and later versions.

I used to have a NAS device that I named "dns323," and which was visible in the Finder as an NFS share. (The unit used a Linux-formatted disk.) In the past few months, whenever I used the excellent Yasu system maintenance utility, it would report an error message, saying that the file "dns323" wasn't found. I eventually realized that this problem started when I stopped using that NAS device. I also noticed that Find Any File was starting very slowly; and when I used Find Any File to see if it could find any trace of "dns323," it listed the file in its results list, but said that the item had disappeared.

I eventually realized that there was a directory named "dns323" in my user folder, but that directory wasn't visible in the Finder, even if I made invisible files visible. The directory name was visible in Terminal, but if I tried to cd into it, I got a message saying "Connection refused." None of the standard Unix commands for deleting a directory had any effect; I typically got a message saying "Resource busy" when I tried.

Eventually, with the help of the experts on the forum on this site, I found that "dns323" was listed in the table of mounts that appeared in Terminal when I entered typed the df command. The dns323 item was listed as "map -static" which, as I understand from other posts, means that it's a mount that isn't actually mounted, but which the system has ready for mounting when needed.

After a lot of other effort, I finally discovered what was creating this phantom mount. There was a .plist file in this folder: /var/db/dslocal/nodes/Default/mounts. The .plist file contained a name that was something like 10.0.1.8%2Fmnt_a2.plist (I'm writing that from memory); the name began with the IP address that the share had when I used it.

I didn't try deleting or moving this plist file while running OS X normally, but I think (on the basis of other postings in other forums about similar files) I could have used sudo rm <filename> to delete it. Instead I booted into single-user mode and moved the file to another location where I could restore it if needed (although I didn't need it). I then booted normally again, opened Terminal and entered rmdir ~/dns323, which was successful.

After this, Find Any File started working at top speed again, and Yasu stopped reporting an error. If file utilities and directory listings seem sluggish on your system, then it may be worth looking for files that create phantom shares in the directory listed above.
    •    
  • Currently 3.17 / 5
  You rated: 2 / 5 (12 votes cast)
 
[9,133 views]  

Clear out phantom NFS shares | 8 comments | Create New Account
Click here to return to the 'Clear out phantom NFS shares' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Clear out phantom NFS shares
Authored by: tempel on Jul 23, '12 07:58:44AM
Thanks for reporting this. I also planned to put this info on my support page for Find Any File. Guess I can simply link to to this page now instead of having to explain it all in my own words. :)

[ Reply to This | # ]
Clear out phantom NFS shares
Authored by: richard2 on Jul 23, '12 09:08:34AM

You should use dscl to modify the files in /var/db/dslocal/nodes/Default, which comprise the local Directory Service database.



[ Reply to This | # ]
Clear out phantom NFS shares
Authored by: emendelson on Jul 23, '12 11:39:50AM

The post about dscl is interesting, and news to me. Could you possibly spell out for non-experts exactly how to find and remove a phantom share with this command? The man pages aren't exactly user-friendly, at least not to this particular user...

Edited on Jul 23, '12 11:40:25AM by emendelson



[ Reply to This | # ]
Clear out phantom NFS shares
Authored by: richard2 on Jul 23, '12 01:29:57PM

Certainly. :)

Firstly, execute dscl in interactive mode:

  1. Open Terminal.
  2. If you're using a Mac OS X user account with standard privileges, then enter su - Account, where Account is the account name, to switch to an account that has administrative privileges.
  3. Enter sudo dscl, then enter your Mac OS X user account password if prompted to.

The following is an example of using dscl in interactive mode:

To navigate to the Mounts directory:

 > cd /Local/Default/Mounts
/Local/Default/Mounts > 

To list the contents of the directory:

/Local/Default/Mounts > ls
Example
/Local/Default/Mounts > 

To read the properties of the Example record:

/Local/Default/Mounts > read Example
Property: Value

/Local/Default/Mounts > 

To remove the Example record:

/Local/Default/Mounts > delete Example
/Local/Default/Mounts > 


[ Reply to This | # ]
Clear out phantom NFS shares
Authored by: emendelson on Jul 23, '12 06:31:02PM

Thank you! Very clear and useful, and better than my brute-force method...!



[ Reply to This | # ]
Clear out phantom NFS shares
Authored by: captainulf on Jul 23, '12 11:09:25PM

Or if you're on Lion or later use Directory Utility which is in /System/Library/CoreServices



[ Reply to This | # ]
Disk Utility -> File -> NFS Mounts
Authored by: lullabud on Jul 23, '12 09:43:29AM

In 10.7 you can see persistent NFS mounts in Disk Utility -> File -> NFS Mounts, though I have a sneaking suspicion this will be absent in 10.8.



[ Reply to This | # ]
Clear out phantom NFS shares
Authored by: emendelson on Jul 23, '12 11:27:56AM

Adding a comment on my own hint. I had a clone of this system on a second Mac, and the clone had the same phantom share, causing the same problems in Find any File and Yasu. On experimenting with this second system, I found that I did NOT need to boot into single-user mode to get rid of the relevant file; I was able to delete it with "sudo rm" in the terminal. After rebooting, I was able to "rmdir" the hidden directory, and the problem went away on that second system, just as it did on the first.



[ Reply to This | # ]