Home » Questions » Computers [ Ask a new question ]

How to remove duplicate "ghost" network drive on OS X?

How to remove duplicate "ghost" network drive on OS X?

In terminal my Volumes directory looks like this:

Asked by: Guest | Views: 474
Total answers/comments: 3
bert [Entry]

"Mac OS X mounts drives by default by creating a folder with the name of the drive in /Volumes and then mounting it at that point (so a drive is normally accessible via /Volumes/NAME_OF_DRIVE). Mac OS X will append a -# after the name of a hard drive if multiple drives of that name are mounted. (eg. /Volumes/NAME_OF_DRIVE-1 and /Volumes/NAME_OF_DRIVE-2, etc.) This will also occur if a folder exists in /Volumes/ by that same name. Even though the mount point has a different name the name of the drive will show correctly in the Finder.

An example of what can cause an erroneous folder:

A script or application that writes a file to /Volumes/ExternalDrive/somefile.txt or even an application that when checking if a file exists (eg. open last saved document) creates a new document at that location when the hard drive/network share/USB key/etc. is not mounted. The file will exists at /Volumes/ExternalDrive/somefile.txt meaning the folder /Volumes/ExternalDrive will exist when you next mount.

Fixing this:

Ensure all drives have been unmounted - use Disk Utility or diskutil list to be sure
Check to see what can be seen in /Volumes/ - recommended to use the Terminal and use ls -laF /Volumes. There should only be one folder (NAME_OF_STARTUP_DRIVE -> /)
Delete the remaining folders. (I'd recommend checking the contents first)"
bert [Entry]

"Here's how I resolved it... and more importantly, what caused it.

Cause
A friend came over and connected to my network while I was using my machine. Their machine, rightly so, showed up in my Finder shares (as a remote drive). During this time, I closed my laptop and it went to sleep -- remembering that it had shares.

A little later I woke my laptop at a hotel, and knowing there was a network I didn't trust, I turned off Apple / Preferences... / Sharing, File Sharing before connecting. It wasn't until days later at home I noticed the ghost machines still in Finder with no way to delete them.

Solution
I went back into Apple / Preferences... / Sharing, File Sharing and turned ON File Sharing (the machines vanished), then I turned OFF File Sharing (they stayed vanished).

Suspicion
I believe this is an edge-case bug, where Finder does not check shares unless it is connected to a network, and if the File Sharing option is turned off while disconnected, it never polls (since 'obviously' you're not sharing anything) to remove stale entries.

FYI, I have logged this as a bug with Apple, # 19977714.

Again, still assuming this is what's happening, it seems that Finder should on either no network or discovering that option is off, remove all Shares and then it doesn't have to check anymore."
bert [Entry]

"Here's how I resolved it... and more importantly, what caused it.

Cause
A friend came over and connected to my network while I was using my machine. Their machine, rightly so, showed up in my Finder shares (as a remote drive). During this time, I closed my laptop and it went to sleep -- remembering that it had shares.

A little later I woke my laptop at a hotel, and knowing there was a network I didn't trust, I turned off Apple / Preferences... / Sharing, File Sharing before connecting. It wasn't until days later at home I noticed the ghost machines still in Finder with no way to delete them.

Solution
I went back into Apple / Preferences... / Sharing, File Sharing and turned ON File Sharing (the machines vanished), then I turned OFF File Sharing (they stayed vanished).

Suspicion
I believe this is an edge-case bug, where Finder does not check shares unless it is connected to a network, and if the File Sharing option is turned off while disconnected, it never polls (since 'obviously' you're not sharing anything) to remove stale entries.

FYI, I have logged this as a bug with Apple, # 19977714.

Again, still assuming this is what's happening, it seems that Finder should on either no network or discovering that option is off, remove all Shares and then it doesn't have to check anymore."