Thursday, July 15, 2010

Ubuntu 10.04: Useless Mount Woes

I was using Ubuntu 10.04.  I had begun using Ubuntu in the belief that I would have a more logical computing experience than I had had in Windows, and in many ways that had been true.  But the whole realm of file permissions just baffled me, and once again it was causing me hassles and lost time.

This time, the problem had to do with what I might call "ghost mountpoints."  I had previously had my external USB drive (named DAILY) listed in fstab, for some purpose or other, but then it seemed that that had been causing a problem, so I removed it.  So now I had a new problem.  Apparently Ubuntu would just take it upon itself to create a nonexistent "mount point" in the /media folder, bearing the same name (i.e., DAILY); and if you unplugged and replugged the drive, it would not adopt the old one, but would instead create a new one, with an underscore appended to it.  So now I had /media/DAILY and /media/DAILY_ and /media/DAILY__ mountpoints, and when I tried to use scripts and such that would refer to plain old DAILY, they would not find it.

The problem, as it had now developed, was that I could not delete those old mountpoints.  They were all empty, but when I went to them in Nautilus -- to, say, /media/DAILY -- and right-clicked on it, the "Move to Trash" option was greyed out; and if I chose Unmount, it said this:

Unable to unmount DAILY
umount: /media/DAILY mount disagrees with the fstab
It said that because I had just now typed "sudo gedit /etc/fstab" and had revived the line that I had previously commented out, the one that provided for recognition of DAILY; and then I had typed "sudo mount -a" to mount the damned thing.  On the other hand, if I went to its sister, DAILY_, and tried the same steps, I got this:
Unable to unmount DAILY
umount: /media/DAILY_ is not in the fstab (and you are not root)
both of which were true.  But then if I typed "sudo nautilus" and went at it through the administrator's (root's) Nautilus, the Unmount option would do nothing, and the Move to Trash option would leave me with this:
Cannot move file to trash, do you want to delete immediately?
The file "DAILY_" cannot be moved to the trash.
Unable to trash file: Device or resource busy
But the Delete option would then give me this:
Error while deleting.
There was an error deleting DAILY_.
Error removing file: Device or resource busy
But what was it busy with?  There was nothing in it!  I did a search for that last error message and, sure enough, found a total of nine hits from the entire Google version of the Internet.  One source gave me the idea of trying "sudo umount -d /media/DAILY."  But I forgot the -d and that command just hung.  I killed that Terminal session and tried again, but it still hung.  I left that hang and tried the same thing with DAILY_.  That hung too.  Back at the drawing board, I tried the same thing but with -f instead of -d.  (This was what I had meant to do in the first place, but the smell of dinner had distracted me.)  Those hung too.

I found a tutorial on solving the problem on a jump drive, where you could just copy your files over to another drive and then delete directories etc.  I didn't want to have to do that with a 500GB external drive.  I tried rebooting the system without the external USB drive connected.  A disk check ran during reboot.  I also got a notice, during reboot, that DAILY was not connected; it noticed, now that I had it included in fstab.  When the system came back up, those DAILY, DAILY_, and DAILY__ entries were gone.  I wished there were a better way of getting rid of them -- it remained to be seen whether that problem would recur, now that DAILY was listed in fstab -- but at least a reboot and/or disk check had done it this time.

0 comments: