Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This post is a little lengthy, sorry. The short version is: I have a directory that I can't delete. Terminal gives, "input/output error," when I try to interact with it. I've scanned the disk for errors and none are found. The root of the problem seems to be that the system thinks this is a link, when in fact it's a directory. How can I delete it?

Story mode: I have a directory called "media" on my desktop, into which I mounted another directory via SSH (fuse/sshfs). The connection was lost while the directory was open. Finder crashed, and the directory disappeared from the desktop. It's still there, however:

Desktop mike$ ls -1  
media  
templates  
Desktop mike$ mkdir media  
mkdir: media: File exists 

Almost everything I try to do to the directory gives me an, "input/output" error:

Desktop mike$ ls -i  
ls: media: Input/output error  
Desktop mike$ sudo rm -rf media  
rm: media: Input/output error  
Desktop mike$ sudo unlink media  
unlink: media: Input/output error  
Desktop mike$ sudo chmod 777 media  
chmod: media: Input/output error  
Desktop mike$ touch media  
touch: media: Input/output error  
cd ./media  
cd: error retrieving current directory: getcwd: cannot access parent directories: Input/output error

I get the same if I try to remount the remote SSH directory:

fuse: bad mount point `./media/': Input/output error

Even though it's not visible on the desktop or in Finder, I can search and find it. Right-clicking the search result doesn't offer a delete option -- only open and properties. Properties shows created and modified time (correctly) and a blank icon. I can also chose to open the item, in which case it gives me:

"The alias 'media' can't be opened because the original item can't be found. Delete, Fix, or OK." 

When I try delete, the same dialog keeps popping back up; choosing fix asks to select a new item to link to. Doing this reports: "Unknown error -1407," which Google tells me means, "Expected a folder but got a file."

I can move the directory, but only if I keep it on the desktop:

Desktop mike$ mv ./media ./a  
Desktop mike$ ls -i  
ls: a: Input/output error  
Desktop mike$ mv ./a ../  
mv: cannot resolve a: /Users/mike/Desktop/a

Is there anyway I can delete this? Or at least convince the system that it's a directory and not a link?

share|improve this question
    
Using srm (developer.apple.com/library/mac/documentation/Darwin/Reference/…) often works for me for things that are hard to delete otherwise. You said "scanned the disk for errors", did you do "verify disk" or "verify disk permissions" (try the permissions and fix them if you haven't done so) –  lupincho Apr 13 '12 at 8:02
    
Hi, thanks for the reply. I did verify disk permissions, verify disk, and repair permissions. I'm not able to select "repair disk," I guess because it didn't find any errors. Using srm on the directory gives me, "srm: Unable to stat media" I've also discovered that some file utilities will tell me the file is a directory (rather than a link). cat and od, for example, before report, "media: is a directory." –  Mike Mitchell Apr 13 '12 at 23:21
    
Did you try to restart the Mac? –  Daniel Beck May 20 '12 at 12:16
    
What happens if you go into the Terminal and type mount? –  Canadian Luke May 20 '12 at 21:26

3 Answers 3

I guess the reason why you can't select "Repair Disk" on Disk Utility is because the problem is on your boot disk.

I would recommend one of the following:

  • If you are on OS X Lion (10.7), boot from the recovery partition (hold CMD-R when you start the machine), run Disk Utility from there, and try to repair the disk;
  • If you are on an older version of OS X, you can either boot from an external disk, or install AppleJack (freeware);
  • If all else fails, I would give a shot to DiskWarrior (not free, but still the tool I trust most when it comes to my data).
share|improve this answer

Sorry I didn't update after resolving this. I appreciate all of the informed replies. Turns out it was a pretty simple thing. Browsing Linux message boards, I found that this is a kind of known issue with mounting via sshfs.

https://bbs.archlinux.org/viewtopic.php?id=94725

I experienced every problem the OP describes in that thread, plus the issue of Finder hiding the mount point (maybe it can't stat it or something, so it just doesn't show it). "...the processes trying to access disconnected sshfs shares go into uninterruptible sleep." The quick fix is to stop sshfs. "killal sshfs" was sufficient for me. I suppose restarting would have worked, too.

share|improve this answer

I just hit the same issue. Turns out this is currently listed as a bug on osxfuse. The workaround involves killing the sshfs process manually and then unmounting the remote directory. After that you can even delete local mount point.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.